zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.64k stars 75 forks source link

Allow overriding or disabling highlighting #149

Closed timm-stelzer-e-farm closed 1 year ago

timm-stelzer-e-farm commented 1 year ago

Currently, highlight.lua links highlights to Comment, which looks weird in my color scheme. Even when I define links in my color scheme for CopilotAnnotation and CopilotSuggestion, this plugin overrides them on load.

It would be nice, if we can either entirely disable links, e.g. via { highlight = { enable = false }}, or supply our own highlight groups, e.g. { highlight = { annotation = 'Foo', suggestion = 'Bar' }}.

Cheers, and thanks for this wonderful plugin, other than this issue, it works great!

MunifTanjim commented 1 year ago

https://github.com/zbirenbaum/copilot.lua/blob/a4a37dda9e48986e5d2a90d6a3cbc88fca241dbb/lua/copilot/highlight.lua#L15

Those are default link. If CopilotAnnotation and CopilotSuggestion are already linked or already defined, it will not override them. Check :help :highlight-default.

timm-stelzer-e-farm commented 1 year ago

Apologies, my issue was entirely unrelated. The highlight groups were overridden on lsp diagnostics, and my usual debugging-approach lead me to believe that it was one of your highlight groups. Apparently there are built-in "semantic tokens", with their own highlights, which were applied at a higher priority.

:TSHighlightCapturesUnderCursor (from tree-sitter) doesn't show those tokens, and I only saw yours. :Inspect did show them. The buggers.