Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml keys are not being coloured #285

Closed
luisdavim opened this issue Jul 25, 2023 · 7 comments
Closed

Yaml keys are not being coloured #285

luisdavim opened this issue Jul 25, 2023 · 7 comments

Comments

@luisdavim
Copy link
Contributor

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
Copy link
Contributor Author

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

@tmillr
Copy link
Member

tmillr commented Jul 28, 2023

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.).

Screen.Recording.2023-07-28.at.12.35.36.PM.mov

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
Copy link
Contributor Author

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
Copy link
Member

tmillr commented Jul 28, 2023

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
Copy link
Contributor Author

luisdavim commented Jul 29, 2023

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
Copy link
Member

tmillr commented Jul 29, 2023

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:

  • To check if a parser is installed and can be found in rtp, do :=vim.treesitter.language.add('json'). This will error otherwise.
  • Check your nvim-treesitter plugin config
  • Run :checkhealth nvim-treesitter and/or :checkhealth vim.treesitter

tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 29, 2023
Rust lifetime highlights, and a few regex-based/legacy highlight
corrections (projekt0n#285).
tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 29, 2023
Rust lifetime highlights, and a few regex-based/legacy highlight
corrections (projekt0n#285).
@luisdavim
Copy link
Contributor Author

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

@ful1e5 ful1e5 closed this as completed Jul 30, 2023
ful1e5 added a commit that referenced this issue Jul 30, 2023
Added logs about #251, #289, #285 in CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants