MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract

Method extract

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

createComponentNodeMethod · 0.95
extractDirectivesMethod · 0.95
extractComponentTagsMethod · 0.95
processCodeBlocksMethod · 0.95
processScriptBlocksMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected