fixed diagnostic float window
This commit is contained in:
parent
768807cbfe
commit
4582fd0c9a
@ -11,4 +11,5 @@ return {
|
||||
}
|
||||
vim.diagnostic.config(diagnostics)
|
||||
end,
|
||||
enabled = false
|
||||
}
|
||||
|
@ -332,9 +332,29 @@ return {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
-- vim.diagnostic.config({ virtual_text = false, virtual_lines = false })
|
||||
-- vim.diagnostic.config({ virtual_text = false, virtual_lines = { only_current_line = true } })
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
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,
|
||||
},
|
||||
})
|
||||
local diag_group = vim.api.nvim_create_augroup('lsp_diagnostic_float', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold' }, {
|
||||
callback = function()
|
||||
vim.diagnostic.open_float({scope = 'line'}, { focus = false })
|
||||
end,
|
||||
group = diag_group,
|
||||
desc = 'Document Highlight',
|
||||
})
|
||||
end,
|
||||
event = 'VeryLazy'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user