Closed antoninhrlt closed 11 months ago
I'm sorry but, this syntax highlighter (also, the new one used by GitHub) is less pretty than the former one. It's also full of weird colors highlighting, some things should be highlighted but they are not, and some others are highlighted by the same color but should be different.
On Github, my README with Rust code became all not pretty
Example of really weird highlighting :
It's not a palette color problem, but a logical problem about the color organization on the Rust tokens.
Kind regards,
I've also had some things highlighting incorrectly (which is why I came here to check), though I would advise not saying "No one cares..." if you do want someone to care, that doesn't tend to be effective.
Maybe you could explain what you mean by "really weird formatting", though? As far as I can tell, what is seen there is consistent, other than that to_string()
is not highlighted when other methods are. I also can't see the mentioned self
keyword here.
I don't know all that much about Treesitter, but I would say that I don't recognize anything in particular there that is to do with Treesitter directly. Treesitter does not highlight colors - and everything you see is highlighted, even if it is white. The groupings of colors, too, is not necessarily something to do with Treesitter. That isn't to say that it is not actually to do with Treesitter, I don't know if it is or not, but that I don't imagine it is something that would be able to be resolved on the Treesitter side without knowing what the actual problem is.
I'm guessing your best bet is looking on the side of whatever is deciding the highlighting in that screenshot. Treesitter allows queries about the syntax of the code to be made: which queries are made, and what is grouped together, is probably more likely a problem with the queries chosen to be made...
I looked through the repo you linked, and I can't actually find where it's defined... maybe it is here, with Treesitter. I don't know... I'm actually trying to copy GitHub's syntax highlighting for Rust in Neovim using Treesitter, which is why I'm here :) Hopefully someone does know what's defined where, though.
I recently updated nvim and treesitter and definitely noticed that Rust syntax highlighting was degraded. It's not the end of the world but I couldn't find an easy way to return to the older version until the new version is at parity.
the parser is not responsible for syntax highlighting, GH's queries and nvim-treesitter's queries are, please file issues there as issues here should be genuine parse issues where valid code fails to parse.
I've explained everything on this issue from github/linguist.
The changes happened because "linguist" started to use "tree-sitter-rust" instead of the one they were using before.
So, I'm opening the issue here to see the changes on this project. But, it's just a question of taste
Regards,