Skip to content

feat: add Visual Basic .NET support - #2885

Open
jorgeluisblanco wants to merge 1 commit into
DeusData:mainfrom
jorgeluisblanco:codex/vbnet-support
Open

jorgeluisblanco wants to merge 1 commit into
DeusData:mainfrom
jorgeluisblanco:codex/vbnet-support

Conversation

@jorgeluisblanco

@jorgeluisblanco jorgeluisblanco commented Nov 2, 2026 •

Copy link
Copy Markdown

Summary

  • add Visual Basic .NET (.vb) language discovery and configuration
  • vendor a patched Tree-sitter VB.NET grammar with license and provenance metadata
  • extract VB.NET types, methods, fields, properties, events, imports, inheritance and calls
  • resolve VB.NET calls case-insensitively and include VB.NET in the .NET language family
  • add corpus, extraction, registry, grammar and reproduction coverage

Validation

  • Tree-sitter corpus: 18/18 passed
  • targeted native test suites: 884 passed
  • reproduction suites: 58 passed
  • language contracts: 44/44 passed
  • production build completed successfully
  • indexed a representative 26-file VB.NET solution with 0 partial/unusable parses and 0 unresolved calls

Fixes #1178

AI assistance

This contribution was prepared with OpenAI Codex under the contributor's direction. The contributor reviewed and tested the changes and accepts responsibility for them.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

Signed-off-by: jorge blanco <jorge.luis.blanco@hotmail.com>
@DeusData

DeusData commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thank you, @jorgeluisblanco, for this VB.NET contribution, and welcome! This is a careful piece of work. The language wiring follows the existing C# and .NET patterns closely. The Inherits/Implements, field, import and constructor extraction is easy to follow. You updated every registration tripwire (call-node manifest, capability ledger, label goldens) consistently. The grammar provenance is written down clearly: the upstream pin, the byte-identical MIT LICENSE, and credit for the patch you built on. That makes our side of the review much easier.

I want to be upfront about how grammar changes work here, so nothing in this comment comes as a surprise later. We vendor third-party grammar code ourselves: we pin the upstream source, verify the licenses, regenerate the parser and do the vendoring in-house, rather than merging generated parser output from a pull request. That is the same note we left on #1178 for the earlier VB.NET work. The files involved here are everything under internal/cbm/vendored/grammars/vbnet/ and tools/tree-sitter-vbnet/, plus the license-audit and checksum tables under scripts/, which only maintainers edit. None of this reflects on the quality of your work. It is a policy we apply to every contribution, including our own.

There is also an older open pull request for the same language, #1179, and both touch the same language slot. We would like to look at the VB.NET grammar choice and the open VB-family pull requests together instead of deciding them one at a time. Some questions are still open on our side, such as which grammar to use, how VB.NET and VB6 share aliases like vb, and how case-insensitive names should resolve. Your PR is a very useful input for those decisions.

Nothing is needed from you right now. We will come back to you here once we have decided how the grammar side will proceed. For when you next touch the branch: the only red CI check is lint, and it is formatting only. clang-format wants the comments in the CBMLanguage enum in internal/cbm/cbm.h re-aligned now that CBM_LANG_VISUALBASIC is the longest entry, plus a few lines in lang_specs.c and extract_defs.c. All the test legs are green.

Thanks again for putting this much care into it, and sorry in advance for the wait while we sort out the grammar side.

@DeusData

Copy link
Copy Markdown
Owner

Hi @jorgeluisblanco, thank you for your patience while this was on hold. As promised on 3 November, we have now decided the VB.NET grammar choice and the open VB-family pull requests together, and we want to explain the reasoning here.

There are two VB.NET pull requests: this one, and #1179, which is built on a different grammar, CodeAnt-AI/tree-sitter-vb-dotnet. That grammar has no license file upstream, so it cannot be vendored by anyone. The grammar you chose, govindbanura/tree-sitter-vbnet, is MIT-licensed, and that is the one we will use. Like every third-party grammar, we vendor it ourselves in our own pull request: we pin the upstream source, verify the license, regenerate the parser and record its provenance in-house. That pull request lands first.

To avoid two competing VB.NET extractors, VB.NET extraction will land through one pull request, #1179, which we port onto that same grammar ourselves. Your work carries into it: the case-insensitive name resolution (VB.NET resolves names case-insensitively, and so will we), and anything else this PR covers that #1179 does not, credited to you with a Co-authored-by line. Two more decisions: vb and visualbasic will mean VB.NET, and VB6 keeps its own name.

Once that has landed, we will close this PR pointing at the merged result. Nothing is needed from you in the meantime. Thank you for choosing a properly licensed grammar, for the case-insensitive resolution, and for your patience.

DeusData added a commit to AmirF194/codebase-memory-mcp that referenced this pull request Nov 10, 2026
Vendors govindbanura/tree-sitter-vbnet (MIT, (c) 2025 Govind Banura) at
538b7087bf80 (tag v0.1-beta, upstream HEAD) with CodeGraph's real-world
VB.NET patch (colbymchenry/codegraph docs/grammars/tree-sitter-vbnet.patch
at fe7542b6f6a4, MIT, (c) 2026 Colby Mchenry), as a self-maintained fork
in tools/tree-sitter-vbnet/. This is the precondition for VB.NET
extraction (DeusData#1179, folding in DeusData#2885); it registers no language yet.

Why this grammar: it is the licensed one. CodeAnt-AI/tree-sitter-vb-dotnet,
which DeusData#1179 was built on, carries no license and cannot be vendored.

Why the patch: upstream checks in grammar.js only and does not parse the
code VB.NET projects are made of. Unpatched, the Single literals in every
WinForms .Designer.vb (New SizeF(6.0!, 13.0!)) and body-less MustOverride
members are ERROR nodes. The 2026-10-06 revision of the patch is pinned
because it also keeps names that begin with a keyword whole: the earlier
revision (the one DeusData#2885 carried) turns `Sub NewItem()` into an ERROR and
`Public SharedCache As Integer` into a Shared field named Cache.

Provenance by hash: the patch file is byte-identical to CodeGraph's (blob
37918d8); upstream grammar.js at the pin is the patch's pre-image
(21c8523), and tools/tree-sitter-vbnet/grammar.js minus its 41-line
provenance header is the post-image (c9c1d85), as is scanner.c (8334fdb).
parser.c is generated here with tree-sitter-cli 0.25.10 (ABI 15); two
independent generations are byte-identical. No upstream script, package
hook or binary was run or vendored.

- internal/cbm/vendored/grammars/vbnet/: the generated parser.c,
  CodeGraph's external scanner.c (two stateless tokens), the tree_sitter/
  headers, upstream's MIT LICENSE byte-identical, and CodeGraph's MIT text
  as LICENSE-codegraph: the scanner and the patched rules are CodeGraph's
  work, so its notice has to ship with the binary too.
- internal/cbm/grammar_vbnet.c: compiles and links tree_sitter_vbnet. No
  CBMLanguage, extension or alias routes to it yet; extraction adds them,
  with `vb` and `visualbasic` meaning VB.NET (VB6 keeps its own name).
- MANIFEST.md (fork note, forks table, 163 grammars, ABI recount),
  THIRD_PARTY.md (fork list and a vbnet section; the stale "160
  pre-generated parsers" now reads 163), scripts/vendored-checksums.txt,
  and the FORKS entry in scripts/audit-license-provenance.py.
- README.md and the Chocolatey nuspec say 163 languages: the
  language-count contract defines the count as the vendored grammar
  directories.
- tests/test_parse_coverage.c: real VB.NET (a WinForms Designer partial
  class, Handles, Inherits/Implements, MustOverride, #Region, Property,
  keyword-prefixed names) parses with no ERROR node. The case fails on
  unpatched upstream (8 ERROR nodes) and on the earlier patch revision (1).

Refs DeusData#1178, DeusData#1179, DeusData#2885

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>

This branch has not been deployed

No deployments
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.

feat: add VB.NET (.vb) tree-sitter structural extraction

2 participants