lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Disable highlight of TODO/NOTE but keep semantic highlighting enabled

Open dlukes opened this issue 3 years ago • 7 comments

Semantic highlighting unfortunately makes TODO/NOTE/etc. strings in comments unreadable with the color scheme I use (https://github.com/rebelot/kanagawa.nvim), but it can be useful otherwise. Is there a way to prevent semantic highlighting from altering the coloring of these TODO/NOTE strings in comments while keeping it enabled?

dlukes avatar Jan 07 '23 07:01 dlukes

Can you provide a screenshot? I don't seem to get any highlighting for TODO/NOTE comments. image

carsakiller avatar Jan 10 '23 17:01 carsakiller

@carsakiller: That's the problem: If sumneko-lsp is disabled then TODO has different highlight, making it easy to tell at a glance, otherwise it's overriden and looks like regular comment.

Check this comparison (above: LSP enabled, below: disabled):

comparison

Color of it obviously depends on your colorscheme.

You can see more details in the issue that I've submitted to a wrong language server: https://github.com/iamcco/diagnostic-languageserver/issues/86

EtiamNullam avatar Jan 10 '23 18:01 EtiamNullam

I see, so this is a request then to add semantic tokens for TODO and NOTE

carsakiller avatar Jan 10 '23 19:01 carsakiller

I will try to reduce unnecessary semantic coloring for comments.

sumneko avatar Jan 12 '23 14:01 sumneko

Is there a workaround for this in the meantime? I'm not very familiar with treesitter, but if there's a snippet I could include in my configuration for this language server that would be great.

heygarrett avatar Nov 09 '24 19:11 heygarrett

@heygarrett if you are using nvim, this snippet disables highlighting of TODO-comments from the lsp, so you keep the lsp highlighting:

vim.api.nvim_set_hl(0, "@lsp.type.comment", {})

chrisgrieser avatar Nov 09 '24 19:11 chrisgrieser

I can confirm this issue still exists, the lsp token will have higher priority than the one defined by tree-sitter-comment.

The workaround has changed to:

vim.api.nvim_set_hl(0, "@lsp.type.comment.lua", {})

badosu avatar Nov 01 '25 04:11 badosu