Closed rudiejd closed 4 months ago
tree-sitter-c-sharp is just a parser - we tokenize the language keywords. These are all just identifiers to us as per the C# Language Specification. We can't know if _member
is a variable, parameter, instance variable etc. without a compilation model to resolve variables recursively within scopes.
That is well beyond what tree-sitter and indeed any C# parser is capable off and into compiler territory. To get that you'd need to switch to a language server with a real compiler such as one backed by Roslyn.
Minimal example:
We should have some way to highlight the members within the member assignment differently than we highlight the other local variables (for example, the member argument to
Example
default constructor.highlighting in neovim using this parser:![image](https://github.com/tree-sitter/tree-sitter-c-sharp/assets/46619169/19fe38d0-6659-489d-bee2-443ebc32103e)
highlighting in jetbrains rider:![image](https://github.com/tree-sitter/tree-sitter-c-sharp/assets/46619169/1a442ccf-c1cb-4e51-b111-146515241978)