projekt0n / github-nvim-theme

Github's Neovim themes
MIT License
2.02k stars 105 forks source link

Yaml keys are not being coloured #285

Closed luisdavim closed 11 months ago

luisdavim commented 11 months ago

Hi, I'm using the latest version of this theme and treesitter. this is how this yaml file https://github.com/luisdavim/synthetic-checker/blob/main/checks.yaml looks like:

image

luisdavim commented 11 months ago

on JSON files the keys are coloured but they are red instead of green. image

tmillr commented 11 months ago

hmmm strange. For the json, put the cursor over the red highlights and do :Inspect. What does it say? If I had to guess, it's probably red due to a syntax/parsing error (e.g. you're missing a comma somewhere, or there's an extra comma somewhere, etc.).

https://github.com/projekt0n/github-nvim-theme/assets/45028928/6e1a3b0e-1e55-4c96-82c8-2283ee8473cc


Also which theme variant are you using? I suspect the yaml issue has something to do with GitHub's choice of colors for the supplement themes such as tritanopia. For me, the yaml looks correct on github_dark_default and github_dark_dimmed.

E.g. with github_dark_default

Screenshot 2023-07-28 at 12 58 56 PM
luisdavim commented 11 months ago

There's no syntax error, that files is from an upstream Kubernetes api definition, I'm using the high contrast variant, I'm not at my computer right now but I'll check the other variants later.

tmillr commented 11 months ago

You can try using the :Inspect cmd on the yaml keys as well to see what it says.

Screenshot 2023-07-28 at 1 03 23 PM
luisdavim commented 11 months ago

This is what I get in yaml: image

An in json: image

And here's a minimal valid json file: image

I'm on the latest versions of all plugins and treesitter syntaxes.

This is the list of plugins I have, I don't think any of them overrides highlights but I may be wrong. And it looks like Treesitter hitghlights are not taking effect, that might be some config issue on my end but sohuldn't this theme also work for popular file types without Treesitter?

tmillr commented 11 months ago

Yeah it appears that treesitter highlighting is not getting used for some reason, and there could be multiple reasons for this which don't have anything to do with the theme. IIRC, a neovim release only comes bundled with with a few ts parsers (e.g. viml, lua, vimdoc, maybe c). Are you sure you have the parsers for the other languages installed? And do you have the nvim-treesitter plugin installed?

sohuldn't this theme also work for popular file types without Treesitter?

This is a question best suited for the repo owner and sole maintainer, @ful1e5. When I first came across this plugin just a few months ago the syntax colors were off, even for treesitter. Since this was really the only plugin for the new gh theme (which is what I wanted), and pretty much the only Lua-based neovim plugin, and prob the most popular as well, I decided to contribute some fixes to the syntax highlights. I have only really focused on treesitter-based highlighting so far as this seems to be the default for nvim now, so fixing those should be prioritized first.

Maybe someone can submit a patch, or maybe I will if I find the time, but I would suggest getting your treesitter setup fixed. Ts highlighting is enabled on a per-buffer basis via an autocmd I believe, but you can also enable it manually with :TSBufEnable highlight (this enables ts highlighting for the current buf).

Some other things you can try:

luisdavim commented 11 months ago

Yeah, got my tree sitter working and I get the expected colours now.