feat(graph): Visual Basic .NET in the code graph (t84) #943

Merged
sharang merged 1 commits from feat/t84-vb-razor into main 2026-11-09 11:50:00 +00:00
Owner

What

This is item 3 of t84 (the backlog: VB, .aspx, .cshtml, .razor). It comes as two stacked PRs:

  • This PR: Visual Basic .NET in the code graph.
  • Next PR, on top of this one: .razor, .cshtml and Web Forms .aspx/.ascx/.master. It needs the VB parser for pages written in VB.

What the graph gets from VB

  • Nodes: classes, modules, structures, interfaces and enums; methods and constructors (Type.New).
  • Edges:
    • Inherits and Implements, kept apart as VB states them (no I-prefix guessing as in C#);
    • calls: x.Find(id), Init without parentheses, and New Pump(3).
  • Entry points: the same rules as C#, compared case-insensitively since VB is:
    • Main in a Module, or Shared Sub Main;
    • <HttpGet>/<WebMethod>-style attributes;
    • ProcessRequest of an IHttpHandler;
    • public or protected members of controllers, Web Forms pages and controls, and ASMX services;
    • any method with a Handles clause (WinForms and Web Forms event handlers).

Grammar and runtime

  • Grammar: tree-sitter-vb-dotnet = "=0.1.0", MIT, pinned exactly like tree-sitter-c-sharp.
  • Provenance:
    • The crate is published from a fork, jamie8johnson/tree-sitter-vb-dotnet, of CodeAnt-AI/tree-sitter-vb-dotnet.
    • grammar.js, src/parser.c, src/grammar.json and src/node-types.json are byte-identical to upstream CodeAnt-AI.
    • build.rs is the standard tree-sitter one: it compiles parser.c, nothing else.
    • The Cargo.lock checksum equals the sha256 of the reviewed archive.
  • Runtime 0.24 → 0.25: the grammar is generated for ABI 15, which tree-sitter 0.24 can't load. 0.25 still loads the existing ABI-14 grammars (Rust, Python, JS, TS, C, C#) with no code change, and the 108 graph tests pass.
  • Known gaps in the grammar, handled here:
    • It expects Inherits/Implements on the Class line, but VB writes them on the next lines. Base types are therefore read from the lines that open the block, including the Class A : Inherits B form.
    • It doesn't parse Handles clauses, LINQ queries or Dim x As New T(). The members around them still come out (tested with a LINQ query in a method body). A Handles clause is recognised from the method's header line.

Also

  • obj/: the graph build now skips it, the .NET build output with generated *.g.cs and, later, the Razor compiler's *.razor.g.cs. bin/ stays in, because Rust keeps sources in src/bin.
  • Dashboard: the language is named "Visual Basic" on the graph card and in the explorer.
  • Control checks: .vb joins the extensions the surface retrieval reads.

Tests

  • VB parser:
    • nodes, including a module and a constructor;
    • the line span of a method after a LINQ line;
    • entry points, including Handles, a lowercase handles and <WebMethodAttribute()>;
    • Inherits/Implements edges with their lines, including generics and the : form;
    • calls with and without parentheses, and New.
  • Registry: a Windows-1252 VB file parses, and obj/ is left out.
  • Dashboard: language_list names "C#, Visual Basic".

Ran locally:

  • fmt;
  • clippy -D warnings on core, agent, graph, mcp, werkbank-exec, control-map, and dashboard with server and with web;
  • lib tests (agent 1021, core 209, graph 108, werkbank-exec, control-map) and dashboard server tests;
  • agent integration tests against Mongo: 97 passed, 0 failed.

🤖 Generated with Claude Code

## What This is item 3 of t84 (the backlog: VB, .aspx, .cshtml, .razor). It comes as two stacked PRs: - **This PR:** Visual Basic .NET in the code graph. - **Next PR, on top of this one:** `.razor`, `.cshtml` and Web Forms `.aspx`/`.ascx`/`.master`. It needs the VB parser for pages written in VB. ### What the graph gets from VB - **Nodes:** classes, modules, structures, interfaces and enums; methods and constructors (`Type.New`). - **Edges:** - `Inherits` and `Implements`, kept apart as VB states them (no `I`-prefix guessing as in C#); - calls: `x.Find(id)`, `Init` without parentheses, and `New Pump(3)`. - **Entry points:** the same rules as C#, compared case-insensitively since VB is: - `Main` in a `Module`, or `Shared Sub Main`; - `<HttpGet>`/`<WebMethod>`-style attributes; - `ProcessRequest` of an `IHttpHandler`; - public or protected members of controllers, Web Forms pages and controls, and ASMX services; - any method with a `Handles` clause (WinForms and Web Forms event handlers). ### Grammar and runtime - **Grammar:** `tree-sitter-vb-dotnet = "=0.1.0"`, MIT, pinned exactly like `tree-sitter-c-sharp`. - **Provenance:** - The crate is published from a fork, jamie8johnson/tree-sitter-vb-dotnet, of CodeAnt-AI/tree-sitter-vb-dotnet. - `grammar.js`, `src/parser.c`, `src/grammar.json` and `src/node-types.json` are byte-identical to upstream CodeAnt-AI. - `build.rs` is the standard tree-sitter one: it compiles `parser.c`, nothing else. - The `Cargo.lock` checksum equals the sha256 of the reviewed archive. - **Runtime 0.24 → 0.25:** the grammar is generated for ABI 15, which tree-sitter 0.24 can't load. 0.25 still loads the existing ABI-14 grammars (Rust, Python, JS, TS, C, C#) with no code change, and the 108 graph tests pass. - **Known gaps in the grammar, handled here:** - It expects `Inherits`/`Implements` on the `Class` line, but VB writes them on the next lines. Base types are therefore read from the lines that open the block, including the `Class A : Inherits B` form. - It doesn't parse `Handles` clauses, LINQ queries or `Dim x As New T()`. The members around them still come out (tested with a LINQ query in a method body). A `Handles` clause is recognised from the method's header line. ### Also - **`obj/`:** the graph build now skips it, the .NET build output with generated `*.g.cs` and, later, the Razor compiler's `*.razor.g.cs`. `bin/` stays in, because Rust keeps sources in `src/bin`. - **Dashboard:** the language is named "Visual Basic" on the graph card and in the explorer. - **Control checks:** `.vb` joins the extensions the surface retrieval reads. ## Tests - **VB parser:** - nodes, including a module and a constructor; - the line span of a method after a LINQ line; - entry points, including `Handles`, a lowercase `handles` and `<WebMethodAttribute()>`; - `Inherits`/`Implements` edges with their lines, including generics and the `:` form; - calls with and without parentheses, and `New`. - **Registry:** a Windows-1252 VB file parses, and `obj/` is left out. - **Dashboard:** `language_list` names "C#, Visual Basic". Ran locally: - fmt; - clippy `-D warnings` on core, agent, graph, mcp, werkbank-exec, control-map, and dashboard with `server` and with `web`; - lib tests (agent 1021, core 209, graph 108, werkbank-exec, control-map) and dashboard server tests; - agent integration tests against Mongo: 97 passed, 0 failed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-09 11:31:04 +00:00
feat(graph): Visual Basic .NET in the code graph (t84)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m12s
CI / Check (pull_request) Successful in 17m46s
9153dee34c
VB.NET classes, modules, structures, interfaces and enums, their methods
and constructors, base types and calls are now nodes and edges, with the
same entry-point rules as C#: Main, ASP.NET controller actions, Web Forms
pages and controls, ASMX web methods, HTTP handlers, and event handlers
wired with Handles.

The grammar is CodeAnt-AI's tree-sitter-vb-dotnet (MIT, pinned 0.1.0,
grammar files identical to upstream). It is generated for ABI 15, so the
tree-sitter runtime moves from 0.24 to 0.25, which still loads the
existing ABI-14 grammars unchanged. The grammar expects Inherits and
Implements on the Class line, so base types are read from the lines that
open the block instead.

The graph build now skips obj/, where .NET writes generated sources, and
the dashboard names the language "Visual Basic".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit 5a11a3b602 into main 2026-11-09 11:50:00 +00:00
Sign in to join this conversation.