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

Turn off semantic tokens or change their behaviour through config.

Open Jacob-Flasheye opened this issue 1 year ago • 1 comments

Hi.

I like this language server a lot, except for the semantic highlighting (when using Neovim). In particular, the semantic tokens overwrite the highlighting on bash commands, which I don't like, as it removes most highlighting in the bash commands. I'm no expert on language servers, but my best guess is that I can change the priority of the highlights in Neovim, but until I learn how to do that I would like to know if there is some setting that will turn off semantic tokens for this language server?

Jacob-Flasheye avatar Aug 17 '23 08:08 Jacob-Flasheye

@Jacob-Flasheye NeoVim has no option to disable semantic highlighting on their end? I feel like the client should be able to just not send requests to the server.

rcjsuen avatar Sep 08 '23 12:09 rcjsuen

@Jacob-Flasheye According to the documentation here, you can opt out of semantic highlighting if you wish. Putting the following code in my init.lua seemed to do the trick for me. I hope this helps!

require("lspconfig").dockerls.setup({
  on_attach = function(client, bufnr)
    -- Opt out of semantic token highlighting
    client.server_capabilities.semanticTokensProvider = nil
  end
})

rcjsuen avatar Jul 31 '24 13:07 rcjsuen