4

I'm using ale for diagnostics, but I want to change how it shows signs. It seems the setup is different for nvim since ALE's docs say they don't have any configuration:

When |g:ale_use_neovim_diagnostics_api| is 1, the only other setting that will be respected for signs is |g:ale_sign_priority|. ALE's highlight groups will and other sign settings will not apply when setting signs through Neovim's diagnostics API. See |diagnostic-signs| for how to configure signs in Neovim.

I added this block based on :h diagnostic-signs to my init.lua:

vim.diagnostic.config{ virtual_text = false, -- floating text next to code is too noisy. underline = true, signs = { text = { [vim.diagnostic.severity.ERROR] = "", [vim.diagnostic.severity.WARN] = "", [vim.diagnostic.severity.INFO] = "", [vim.diagnostic.severity.HINT] = "", }, linehl = { [vim.diagnostic.severity.ERROR] = 'ErrorMsg', }, numhl = { [vim.diagnostic.severity.WARN] = 'WarningMsg', }, }, } 

ALE's diagnostics in my left margin still use letters:

signs using W

If I :luafile % my init.lua, then the signs use symbols:

signs using symbol

I'm also using these plugins to setup my lsp (using luals for lua):

  • lspconfig
  • mason
  • mason-lspconfig

The above vim.diagnostic.config setting successfully removes the floating text from lsp warnings, so it's partially working but not for signs. Disabling these other lsp plugins doesn't help.

Am I putting my diagnostic settings in the wrong place?


:echo g:ale_use_neovim_diagnostics_api 1 :version NVIM v0.10.0 

2 Answers 2

0

This works:

vim.diagnostic.config({ underline = false, signs = { active = true, text = { [vim.diagnostic.severity.ERROR] = "", [vim.diagnostic.severity.WARN] = "", [vim.diagnostic.severity.HINT] = "󰟃", [vim.diagnostic.severity.INFO] = "", }, }, virtual_text = false, float = { border = "single", format = function(diagnostic) return string.format( "%s (%s) [%s]", diagnostic.message, diagnostic.source, diagnostic.code or diagnostic.user_data.lsp.code ) end, }, }) 
0
0

This turned out to be a bug that's now fixed in ale. I'm using v4.0.0 (1c911021) and now my sign configuration based on :h diagnostic-signs works as expected.

I think it was commit "Consider the original config for signs in Neovim" that fixed it.

1
  • Wow, long time wait for that one! Glad it is fixed for you :) Commented Aug 21 at 1:52

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.