LSP: enable using different highlighting rules for LSP signs (#12176)

This commit creates 4 new highlight groups:
- LspDiagnosticsErrorSign
- LspDiagnosticsWarningSign
- LspDiagnosticsInformationSign
- LspDiagnosticsHintSign

These highlight groups are linked to their corresponding LspDiagnostics
highlight groups by default.

This lets users choose a different color for their sign columns and
virtualtext diagnostics.
This commit is contained in:
Ghjuvan Lacambre
2020-04-29 16:53:13 +02:00
committed by GitHub
parent e9cc383614
commit f9055c585f
4 changed files with 21 additions and 8 deletions

View File

@@ -1024,10 +1024,10 @@ do
vim.fn.sign_define(name, properties)
end
end
define_default_sign('LspDiagnosticsErrorSign', {text='E', texthl='LspDiagnosticsError', linehl='', numhl=''})
define_default_sign('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarning', linehl='', numhl=''})
define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformation', linehl='', numhl=''})
define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHint', linehl='', numhl=''})
define_default_sign('LspDiagnosticsErrorSign', {text='E', texthl='LspDiagnosticsErrorSign', linehl='', numhl=''})
define_default_sign('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarningSign', linehl='', numhl=''})
define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformationSign', linehl='', numhl=''})
define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHintSign', linehl='', numhl=''})
end
return lsp

View File

@@ -672,6 +672,7 @@ do
table.insert(cmd_parts, k.."="..v)
end
api.nvim_command(table.concat(cmd_parts, ' '))
api.nvim_command('highlight link ' .. highlight_name .. 'Sign ' .. highlight_name)
severity_highlights[severity] = highlight_name
end