Fix C# support: wire tree-sitter-c-sharp grammar into parser#2
Merged
DeusData merged 1 commit intoDeusData:mainfrom Feb 28, 2026
Merged
Conversation
C# was listed as a supported language but every .cs file produced "unsupported language: c-sharp" because the tree-sitter grammar was never wired up. The comment cited a "module path mismatch", but github.com/tree-sitter/tree-sitter-c-sharp is a valid Go module path (hyphens are allowed); the Go package inside simply uses underscores (tree_sitter_c_sharp), which is standard Go convention. Fix: add the import and map lang.CSharp to tree_sitter_c_sharp.Language() in parser.go. Also remove the C# skip from TestAllLanguagesLoad and add TestParseCSharp to verify class and method parsing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DeusData
added a commit
that referenced
this pull request
Feb 28, 2026
Owner
|
Merged into main via local rebase + merge. Thank you for fixing C# support! |
12 tasks
DeusData
added a commit
that referenced
this pull request
Mar 9, 2026
Fix C# support: wire tree-sitter-c-sharp grammar into parser
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.
Problem
C# is listed as a supported language in the README but every
.csfile produces:The language spec in
internal/lang/csharp.gois fully defined, but the tree-sitter grammar was commented out inparser.gowith:// C# skipped: upstream module path mismatch (tree-sitter-c-sharp vs tree-sitter-c_sharp)Root Cause
There is no actual module path mismatch.
github.com/tree-sitter/tree-sitter-c-sharpis a valid Go module path — hyphens are permitted in module paths. The Go package inside the module uses underscores (tree_sitter_c_sharp), which is standard Go convention for packages derived from hyphenated names. Every other grammar in this repo follows exactly the same pattern (e.g.tree-sitter-cpp→tree_sitter_cpp).Fix
tree_sitter_c_sharp "github.com/tree-sitter/tree-sitter-c-sharp/bindings/go"toparser.golang.CSharp: tree_sitter.NewLanguage(tree_sitter_c_sharp.Language())to the language mapindirectto direct ingo.modTestAllLanguagesLoadTestParseCSharpto verify class and method parsingResult
Before: 107 nodes / 110 edges on a 61-file C# codebase (only folder/file structure)
After: 1,255 nodes / 1,339 edges (995 methods, 90 classes, 2 enums fully parsed)
All existing tests continue to pass.
🤖 Generated with Claude Code