I have the following in my config
vim.diagnostic.config {
virtual_text = false,
underline = false,
update_in_insert = false,
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
header = '',
prefix = '',
},
}
which works as expected. I'd like to enable the virtual_text
and underline
for certain LSP specifically though. Is there a way to specific the config per LSP?
You could define an autocommand depending on your filetype to modify your LSP configuration.
For example, to enable virtual_text
and underline
only for Python filetype:
vim.api.nvim_create_autocmd('BufRead', {
group = vim.api.nvim_create_augroup('filetype_python', { clear = true }),
desc = 'Set LSP diagnostics for Python',
pattern = { '*.py' },
callback = function()
vim.diagnostic.config({
virtual_text = true,
underline = true,
})
end,
})