Feature: Add VB.NET support via Roslyn#627
Open
Michael2150 wants to merge 3 commits into
Open
Conversation
Introduce VB.NET support by adding a Roslyn-based extractor (src/extraction/roslyn-extractor.ts) that invokes a bundled or env-provided codegraph-roslyn binary. Wire vbnet into language lists and detection: add '.vb' extension mapping, include vbnet in LANGUAGES and getSupportedLanguages(), and mark it as supported/no-WASM grammar in grammars.ts. Hook the RoslynExtractor into extractFromSource so VB.NET files are extracted via Roslyn. Add unit tests for VB.NET detection and update package.json to include the bundled bin artifacts. Update CHANGELOG to announce VB.NET support.
Store the provided source as a class property and pass it to the Roslyn extractor binary via stdin. The execFileSync call now includes a --stdin flag and the input option is set to this.source, so the binary doesn't need to locate the file on disk (the existing --file arg is retained for node IDs / qualified name generation). A brief comment explaining the change was also added.
treytracedit-lab
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add VB.NET support via Roslyn
Closes #170
Adds
.vbfile indexing to codegraph. Tree-sitter has no VB.NET grammar, and the only published option (tree-sitter-vb-dotnet) is unmaintained since July 2025, missing LINQ and XML literals, has an open licensing question, and has no published WASM build. Instead this uses Roslyn (the actual .NET compiler) via a small companion CLI tool, giving compiler-accurate extraction with full language coverage.The integration follows the existing standalone extractor pattern used by
DfmExtractorandMyBatisExtractor: aRoslynExtractorclass invokes the subprocess, maps its JSON output toExtractionResult, and plugs into the existing dispatch inextractFromSource(). No changes to the extraction pipeline architecture.What gets extracted
Nodes: classes, modules, interfaces, structs, enums, methods, properties, fields, imports, namespaces
Edges: calls, extends, implements, overrides, instantiates, plus VB.NET-specific patterns (
Handles/WithEventsevent wiring,RaiseEvent)Files changed
src/types.ts-'vbnet'added toLANGUAGESsrc/extraction/grammars.ts-.vbextension mapping;isLanguageSupported,isGrammarLoaded,getSupportedLanguagesupdated (without this the orchestrator silently skips every.vbfile before reaching the extractor)src/extraction/roslyn-extractor.ts(new) - subprocess bridge; selects the right platform binary frombin/viaprocess.platform+process.arch;CODEGRAPH_ROSLYN_BINenv var overrides for developmentsrc/extraction/tree-sitter.ts-vbnetdispatch branch; C# continues using tree-sitter unchangedpackage.json-"bin"added tofilesfor binary bundling__tests__/extraction.test.ts- 3 new tests; all pass without the binary presentWhy not tree-sitter-vb-dotnet?
Future: C# via Roslyn
C# currently continues to use the tree-sitter extractor unchanged. The
RoslynExtractoralready detects.csfiles and the companion tool supports C# extraction with the same node/edge coverage. Switching C# over in a follow-up PR would give it the same compiler-accurate extraction, with better qualified name resolution and semantic edges that tree-sitter can't provide.Companion tool
Michael2150/codegraph-roslyn is a .NET 8 console app using
Microsoft.CodeAnalysis.VisualBasic. It has 131 xUnit tests covering nodes, edges, and VB.NET-specific patterns and cross-compiles to all five platform targets from a single runner.Binaries
The platform executables are not committed to this repo. They should be downloaded from the codegraph-roslyn v1.0.0 release and placed in
bin/before publishing:codegraph-roslyn-win-x64.execodegraph-roslyn-osx-x64codegraph-roslyn-osx-arm64codegraph-roslyn-linux-x64codegraph-roslyn-linux-arm64Happy to add a download step to the release workflow if that's the preferred approach.