Skip to content

Feature: Add VB.NET language support (tree-sitter approach)#675

Open
Michael2150 wants to merge 1 commit into
colbymchenry:mainfrom
Michael2150:feature-add-vb.net-language-support
Open

Feature: Add VB.NET language support (tree-sitter approach)#675
Michael2150 wants to merge 1 commit into
colbymchenry:mainfrom
Michael2150:feature-add-vb.net-language-support

Conversation

@Michael2150
Copy link
Copy Markdown

Add native VB.NET tree-sitter extraction

Supersedes #170 (closed — never applied).

The original PR depended on an external companion project (codegraph-roslyn) that invoked Roslyn as a subprocess and required shipping platform-specific native binaries alongside the npm package. That approach doesn't fit the self-contained model codegraph uses for every other language, so this PR rebuilds VB.NET support from scratch using a bundled tree-sitter grammar instead.

What gets extracted

Node kinds: class, module, struct, interface, enum, enum_member, method (Sub/Function, constructors via Sub New), property, field, constant, namespace, import

Edges: calls (invocations), contains, imports, instantiates

VB.NET-specific handling:

  • Module blocks extracted as module kind with isStatic: true (VB.NET Modules are implicitly static sealed types, not regular classes)
  • Structure blocks extracted as struct kind with full member nesting (fields, properties, methods)
  • Inherits/Implements lines are filtered out — the grammar misparsed them as field_declaration nodes; the extractor detects and drops them
  • Sub New extracted as a method named New (constructor)
  • Shared modifier maps to isStatic: true
  • Friend modifier maps to 'internal' visibility
  • Async modifier maps to isAsync: true
  • Method signatures: (params) As ReturnType for Functions, (params) for Subs

Files changed

  • src/types.ts'vbnet' added to LANGUAGES
  • src/extraction/grammars.ts.vb extension mapping, 'vbnet': 'VB.NET' display name, vendored wasm path
  • src/extraction/languages/vbnet.ts (new) — full VB.NET extractor: type classification, visibility, modifiers, signature generation, namespace/module/struct/const handling via visitNode
  • src/extraction/languages/index.tsvbnetExtractor registered
  • src/extraction/wasm/tree-sitter-vbnet.wasm (new) — bundled grammar (see provenance below)
  • __tests__/extraction.test.ts — smoke test covering all node kinds in one pass
  • CHANGELOG.md — entry under [Unreleased]
  • README.md — VB.NET listed as supported

src/extraction/wasm/tree-sitter-vbnet.wasm — provenance

Built from tree-sitter-vb-dotnet@0.1.9 (by codeant-ai).
The npm package ships grammar source only (no prebuilt WASM), so the file was compiled locally:

npm pack tree-sitter-vb-dotnet          # download tarball
tar -xzf tree-sitter-vb-dotnet-0.1.9.tgz -C /tmp/vb-grammar
cd /tmp/vb-grammar/package
npm install -g tree-sitter-cli          # tree-sitter 0.26.9
tree-sitter build --wasm               # downloads wasi-sdk, compiles parser.c -> .wasm
cp tree-sitter-vb_dotnet.wasm <repo>/src/extraction/wasm/tree-sitter-vbnet.wasm

Testing

Validated against the codegraph-roslyn fixture repo (7 VB.NET files, 20 C# files):

  • 146 VB.NET nodes extracted across all 7 files, zero parse errors
  • All node kinds present: class (14), method (58), field (21), property (17), enum (2), enum_member (8), struct (2), module (1), interface (3), namespace (8), import (5)
  • 164 edges: contains (139), calls (18), imports (5), instantiates (2)
  • C#/VB parity across parallel fixture files (Animals, AsyncPatterns, EventSystem, ImportAliases all within +/-1 node)

Add first-class VB.NET support via a bundled tree-sitter grammar and extractor. This introduces a new wasm grammar (tree-sitter-vbnet.wasm), a vbnet language extractor implementation, and comprehensive unit tests for class/module/method/enum/import/property/constant/call extraction. The Roslyn-based extractor and its special-casing were removed so VB.NET is parsed natively by the tree-sitter pipeline; loader/registry code was updated to include the vbnet WASM and extractor. README, changelog, and agent-eval corpus were updated to document VB.NET support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant