stsewd / tree-sitter-comment

Tree-sitter grammar for comment tags like TODO, FIXME(user).
https://stsewd.dev/tree-sitter-comment/
MIT License
126 stars 8 forks source link

How to customise the highlight colours? #31

Closed vimtoe closed 9 months ago

vimtoe commented 9 months ago

hi, first - thanks! forgive me for this is not really an "issue" as I am sure it is already achievable,. I understand that treesitter queries can be modified fairly easily, for highlighting its /after/queries/$LANGUAGE/highlights.scm, in this case, would $LANGUAGE be comment ? and if its not too much to ask (as Im a noob and others may benefit from it), could you possibly either post an example here or add it to the README for changing the available highlights provided please? thank you once again for a great parser!

ColinKennedy commented 9 months ago

To find out what highlight group to edit ...

The stuff within "Treesitter" and ending in ".comment" are all possible highlight targets that you can set.

For example

Change @text.uri.comment

vim.api.nvim_set_hl(0, "@text.uri", {bg="#333333"})  -- More general
-- or
vim.api.nvim_set_hl(0, "@text.uri.comment", {bg="#333333"})  -- More specific

The highlights are hierarchical. So changing "@text.uri" will also be inherited by "@text.uri.comment"

For more details check out :help nvim_set_hl()

vimtoe commented 9 months ago

apologies for not responding sooner! allow me to close this, you suggestions above worked perfectly! and thank you for your work.