MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / extract

Method extract

src/extraction/razor-extractor.ts:63–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 }
62
63 extract(): ExtractionResult {
64 const startTime = Date.now();
65 try {
66 const componentId = this.createComponentNode().id;
67 this.extractDirectives(componentId);
68 // Blazor component tags only — `.cshtml` uses HTML + tag helpers, not
69 // PascalCase component elements.
70 if (this.filePath.toLowerCase().endsWith('.razor')) {
71 this.extractComponentTags(componentId);
72 }
73 // Delegate the C# in `@code { }` / `@functions { }` / `@{ }` blocks to the
74 // C# tree-sitter extractor (the Blazor analog of Svelte's <script> block) —
75 // this is where component logic uses services/DTOs, so it covers the types
76 // referenced only from component code.
77 this.processCodeBlocks(componentId);
78 } catch (error) {
79 this.errors.push({
80 message: `Razor extraction error: ${error instanceof Error ? error.message : String(error)}`,
81 severity: 'error',
82 code: 'parse_error',
83 });
84 }
85 return {
86 nodes: this.nodes,
87 edges: this.edges,
88 unresolvedReferences: this.unresolvedReferences,
89 errors: this.errors,
90 durationMs: Date.now() - startTime,
91 };
92 }
93
94 private createComponentNode(): Node {
95 const lines = this.source.split('\n');

Callers

nothing calls this directly

Calls 4

createComponentNodeMethod · 0.95
extractDirectivesMethod · 0.95
extractComponentTagsMethod · 0.95
processCodeBlocksMethod · 0.95

Tested by

no test coverage detected