Target branch: main
Language
- Language: C#
- File extensions:
.cs
- Tree-sitter grammar repository: https://github.com/tree-sitter/tree-sitter-c-sharp
- Grammar version or commit:
tree-sitter-c-sharp@0.23.5 (npm) — note: use this package's own bundled tree-sitter-c_sharp.wasm, not tree-sitter-wasms@0.1.12's copy of the same filename; they are different grammar revisions and several documented fields (variable_declarator.name, using_directive.name) resolve to undefined via childForFieldName against the older build.
- Grammar license: MIT
Scope
A tree-sitter-only extractor (no compiler integration, following the python.ts/rust.ts pattern rather than typescript.ts's compiler-based path) covering the common C# declaration and reference surface: classes, interfaces, structs, enums (with members), methods (incl. constructors/destructors, static, async), properties, fields (incl. const → constant), parameters, namespaces (block and file-scoped, including nesting), using imports, attributes as decorates, calls/instantiates/extends/implements references.
Known, documented limitation: base_list has no field structure and does not syntactically distinguish a base class from an implemented interface (verified against node-types.json). The extractor uses a first-listed-entry-is-the-base-class heuristic (extends for entry 0 on a class/struct, implements for the rest; every entry is extends on an interface) — a documented best-effort, not a semantic guarantee.
Not in scope for this first pass: generics/type-parameter capture (typeParameters), LINQ query-clause references, records/delegates get a best-fit existing NodeKind (class, type_alias) rather than dedicated kinds.
Expected nodes
class, struct, interface, enum, enum_member, method, function (local functions), property, field, constant (const fields), parameter, namespace, type_alias (delegates), file.
Expected edges
contains, calls, imports (using), extends, implements, instantiates (new T()), decorates (attributes).
Required proof
Blocked by
None.
Additional context
Implementation is done and validated: 11 focused tests (extractor-csharp.test.ts) plus a full local npm test run (533/533 passing, no regressions), and a real-world smoke test against a ~640-file C# codebase (a .NET Azure Functions calculation engine) — 694 .cs-tree files, 0 partial/failed, 22,694 nodes / 25,250 edges. Opening a PR against this issue next.
Language
.cstree-sitter-c-sharp@0.23.5(npm) — note: use this package's own bundledtree-sitter-c_sharp.wasm, nottree-sitter-wasms@0.1.12's copy of the same filename; they are different grammar revisions and several documented fields (variable_declarator.name,using_directive.name) resolve toundefinedviachildForFieldNameagainst the older build.Scope
A tree-sitter-only extractor (no compiler integration, following the
python.ts/rust.tspattern rather thantypescript.ts's compiler-based path) covering the common C# declaration and reference surface: classes, interfaces, structs, enums (with members), methods (incl. constructors/destructors, static, async), properties, fields (incl.const→constant), parameters, namespaces (block and file-scoped, including nesting),usingimports, attributes asdecorates,calls/instantiates/extends/implementsreferences.Known, documented limitation:
base_listhas no field structure and does not syntactically distinguish a base class from an implemented interface (verified againstnode-types.json). The extractor uses a first-listed-entry-is-the-base-class heuristic (extendsfor entry 0 on a class/struct,implementsfor the rest; every entry isextendson an interface) — a documented best-effort, not a semantic guarantee.Not in scope for this first pass: generics/type-parameter capture (
typeParameters), LINQ query-clause references, records/delegates get a best-fit existingNodeKind(class,type_alias) rather than dedicated kinds.Expected nodes
class,struct,interface,enum,enum_member,method,function(local functions),property,field,constant(constfields),parameter,namespace,type_alias(delegates),file.Expected edges
contains,calls,imports(using),extends,implements,instantiates(new T()),decorates(attributes).Required proof
Languagevocabulary ("csharp"is already inLANGUAGES,src/graph/types.ts) — no core vocabulary addition neededLanguageExtractorinterfacenpm run typecheck,npm test, andnpm run buildwill passBlocked by
None.
Additional context
Implementation is done and validated: 11 focused tests (
extractor-csharp.test.ts) plus a full localnpm testrun (533/533 passing, no regressions), and a real-world smoke test against a ~640-file C# codebase (a .NET Azure Functions calculation engine) — 694.cs-tree files, 0 partial/failed, 22,694 nodes / 25,250 edges. Opening a PR against this issue next.