Java grammar not fully recognized
asmodeus812 opened this issue · comments
Hi, I have just enabled tree sitter with emacs, and i am facing a weird issue where the java grammar is not correctly colouring the symbols, while other grammars (such as the ts or c/c++ do seem to work fine) Below i have provided a sample screenshot for different languages. I am using the doom themes pack (but even without a theme enabled, I see the same issues). I am also using LSP but have disabled highlighting with:
lsp-enable-semantic-highlighting nil
lsp-semantic-tokens-enable nil
Here is the java colouring scheme, as you can see member variable (userRegistry) and function parameters are not coloured at all in the body or in the function header
Another sample in C where for some reason the block_alignment is not coloured in the function header and the places where it is used, but is coloured only in the assignment expression ?
Another simple example in TS, where a keyword (this) is coloured the same as a function, and void which you can either count as a keyword or a type is again the same colour as a function declaration/definition.
Over all there are vast inconsistencies between very simple language constructs as member attributes, function definitions/declarations, function arguments, variables etc. I assume those are defined to be understood by default in the grammar as they seem obvious enough.
Hi, I have just enabled tree sitter with emacs, and i am facing a weird issue where the java grammar is not correctly colouring the symbols, while other grammars (such as the ts or c/c++ do seem to work fine)
Please report language-specific issues to tree-sitter-langs or upstream grammar repositories.
To help troubleshooting, it's better to include texts that can be copied.
Here is the java colouring scheme, as you can see member variable (userRegistry) and function parameters are not coloured at all in the body or in the function header
Another sample in C where for some reason the block_alignment is not coloured in the function header and the places where it is used, but is coloured only in the assignment expression ?
Please check https://github.com/emacs-tree-sitter/tree-sitter-langs#highlighting-queries.
Another simple example in TS, where a keyword (this) is coloured the same as a function, and void which you can either count as a keyword or a type is again the same colour as a function declaration/definition.
Over all there are vast inconsistencies between very simple language constructs as member attributes, function definitions/declarations, function arguments, variables etc. I assume those are defined to be understood by default in the grammar as they seem obvious enough.
They should be understood by the grammars. How they are highlighted is a different issue. You can use M-x what-cursor-position
to see what a piece of text is highlighted with. For how they are highlighted, check the doc on syntax highlighting.