Repository navigation
Conversation
Index VB.NET (.vb) — classes, modules, structures, interfaces, enums, Subs/Functions, properties, constants, and Imports — with call, instantiation, and inheritance (Inherits/Implements) edges that resolve across files. Grammar: vendors a locally-patched build of CodeAnt-AI/tree-sitter-vb-dotnet (MIT). The upstream 0.1.x grammar couldn't parse generic (Of T) declarations, separate-line Inherits/Implements, member-level Implements/Handles, New Foo(args), the As New shorthand, nested types, #Region, Enum As <type>, For Each typed loop vars, Dim array declarators, attributes, ?. null- conditional access, or implicit line continuation inside () / after binary operators. All patches + rebuild steps are in docs/grammars/vbnet/. Extractor (src/extraction/languages/vbnet.ts) maps the grammar to the LanguageExtractor config and adds: - resolveBody hook so call/reference extraction reaches inline method bodies (VB declarations have no body field); extractStruct now consults resolveBody too, so structures (which also lack one) extract. - visitNode hook emitting extends/implements edges from the line-statement Inherits/Implements clauses the core's field-based extractor can't see. - With-receiver inference: leading-dot calls (With obj … .Member) are qualified with the inferred receiver type via a new general resolveCallName extractor hook, or dropped when the type is unknown — never a bare, mis-resolving ref. Resolver: a callable-aware VB-intrinsics filter (UBound, Len, CInt, …) drops stray edges where an intrinsic name-matches a non-callable user symbol, while leaving genuine user methods resolvable. Const fields are classified as constant kind. Validated on a 1,146-file VB.NET codebase: 53k call edges (40k cross-file), no node explosion, ~14s to index. Adds parameterized extraction tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
Adds VB.NET (
.vb) indexing to codegraph — classes, modules, structures, interfaces, enums, Subs/Functions, properties, constants, andImports, with call, instantiation, and inheritance edges that resolve across files.Grammar
Vendors a locally-patched build of
CodeAnt-AI/tree-sitter-vb-dotnet(MIT). The upstream 0.1.x grammar producedERRORtrees on ordinary VB; the patches close generic(Of T)declarations, separate-lineInherits/Implements, member-levelImplements/Handles,New Foo(args), theAs Newshorthand, nested types,#Region,Enum As <type>,For Eachtyped loop vars,Dimarray declarators, attributes,?.null-conditional access, and implicit line continuation inside()/ after binary operators. Full patch set, rebuild steps, and a real-world status writeup live indocs/grammars/vbnet/.Extractor (
src/extraction/languages/vbnet.ts)resolveBodyhook so call/reference extraction reaches inline method bodies (VB declarations have nobodyfield);extractStructnow consults it too, so structures extract.visitNodehook emittingextends/implementsedges from the line-statementInherits/Implementsclauses the core's field-based extractor can't see.With-receiver inference: leading-dot calls (With obj….Member) are qualified with the inferred receiver type via a new generalresolveCallNameextractor hook, or dropped when the type is unknown — never a bare, mis-resolving ref.Resolver
A callable-aware VB-intrinsics filter (
UBound,Len,CInt, …) drops stray edges where an intrinsic name-matches a non-callable user symbol, while leaving genuine user methods resolvable.Constfields are classified asconstantkind.Validation
Indexed a real 1,146-file VB.NET codebase: ~53k call edges (~40k cross-file), 555 inheritance edges, no node explosion, ~14s to index. A with/without A/B on a cross-assembly trace had codegraph answer in 1 command / 0 file reads vs the baseline's 11 greps. New parameterized extraction tests cover detection, structure, inheritance, intrinsics filtering, continuation, and With-receiver inference; full suite green (1,588 passing).
Status & known gaps
Support is experimental — the vendored grammar is young, so method-body control flow can parse incompletely on some files (the class/method structure and most call edges still extract). Remaining gaps (documented in
docs/grammars/vbnet/README.md): leading-dot method chains and assignment/return continuations are unparsed (~34% of files parse fully clean, though extraction holds up well past that via local error recovery); multi-namespaceImports A, Bkeeps only the first; no VB framework resolvers yet.🤖 Generated with Claude Code