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

[Feature Request] LSP semantic highlighting support #41

Open
alexmozaidze opened this issue Apr 27, 2023 · 1 comment
Open

[Feature Request] LSP semantic highlighting support #41

alexmozaidze opened this issue Apr 27, 2023 · 1 comment

Comments

@alexmozaidze
Copy link

alexmozaidze commented Apr 27, 2023

Normally, highlighting is ok, but when an LSP kicks in, it recolors some of the identifiers wrongly (mainly variables)

Before LSP:
just-tree-sitter
After LSP:
tree-sitter-and-lsp

@alexmozaidze
Copy link
Author

I did some research. I found out that the issue was the semantic highlighting of the LSP.
In order to disable them, put this snippet in your init.lua

vim.api.nvim_create_autocmd({ "ColorScheme" }, {
  callback = function()
    -- Hide semantic highlights for functions
    vim.api.nvim_set_hl(0, '@lsp.type.function', {})

    -- Hide all semantic highlights
    for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
      vim.api.nvim_set_hl(0, group, {})
    end
  end,
})

This snippet was basically a copy-paste from :h lsp-semantic-highlight into an autocmd; it also contains info on doing the highlighting.

@alexmozaidze alexmozaidze changed the title [Feature Request] LSP support [Feature Request] LSP semantic highlighting support Apr 27, 2023
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

1 participant