--- id: tree-sitter-c-sharp version: "0.23.5" license: MIT license_treatment: permissive maintenance: active --- # tree-sitter-c-sharp — C# grammar for tree-sitter License: permissive · Maintenance: active · Downloads: 10.7M/mo ## What it is and what it does tree-sitter-c-sharp is a language grammar binding that plugs C# parsing into the tree-sitter incremental parsing framework. It translates the Roslyn C# grammar into tree-sitter's format, with adaptations to handle preprocessor directives, syntax fragments, and edge cases where the two parsing technologies differ. The result is a fast, incremental parser that builds abstract syntax trees for C# code without external dependencies. You use it by installing the package and importing the language binding. It's designed for tools that need to analyze, transform, or highlight C# syntax—editors, linters, code generators, or language servers—where incremental re-parsing on edits is valuable. The package supports C# 1 through 13.0, with a documented exception for `async`, `var`, and `await` as identifiers in certain contexts. Use it for: - Build a C# code linter or style checker that re-parses only changed sections on each edit. - Implement syntax highlighting or code folding in an editor or IDE plugin using incremental parsing. - Generate C# AST data for static analysis, refactoring tools, or code generation pipelines. - Create a language server protocol implementation for C# with incremental parsing support. - Parse C# code fragments (snippets, REPL input) without requiring a full compilation context. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a C# language parser for tree-sitter, enabling incremental syntax analysis and parsing of C# code from versions 1 through 13.0. Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and fills a specific need for incremental C# parsing in the tree-sitter ecosystem. Install it if you're building tools that parse or analyze C# code and want fast, dependency-light syntax tree generation. The medium install friction is offset by broad platform support and zero runtime dependencies. ## Install pip install tree-sitter-c-sharp uv add tree-sitter-c-sharp poetry add tree-sitter-c-sharp ## Installing tree-sitter-c-sharp Before you install: Medium install friction due to precompiled wheels across multiple platforms (macOS, Linux, Windows, ARM64), but no runtime dependencies and active maintenance with a recent release. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: pip install tree-sitter-c-sharp from tree_sitter_c_sharp import language Requires Python 3.9 or later; tree-sitter core library must be installed separately. Verify before relying: - Whether the parser handles all C# 13.0 features or only those explicitly tested in the grammar - Performance characteristics for large codebases or real-time parsing scenarios - Compatibility with specific tree-sitter versions or API stability guarantees - How to instantiate and use the language binding with tree-sitter's Parser interface ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 10.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags c# parser tree-sitter, incremental c# parsing, c# syntax tree analysis, tree-sitter language grammar, c# code parsing library, c# grammar binding, c# ast generation, parser, c-sharp, syntax-tree [View on SkillFed](https://skillfed.io/packages/tree-sitter-c-sharp) · [View on PyPI](https://pypi.org/project/tree-sitter-c-sharp/)