make diagnostics prettier and show them in pop-up
This commit is contained in:
@@ -14,3 +14,27 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
vim.keymap.set('n', '<leader>p', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '<leader>p', vim.diagnostic.goto_prev, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Show diagnostics in bordered pop-up
|
||||||
|
vim.diagnostic.config { virtual_text = false, float = { border = 'rounded' } }
|
||||||
|
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.hover, { border = 'rounded' }
|
||||||
|
)
|
||||||
|
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.signature_help, { border = 'rounded' }
|
||||||
|
)
|
||||||
|
vim.o.updatetime = 500
|
||||||
|
vim.api.nvim_create_autocmd({'CursorHold'}, {
|
||||||
|
pattern = {'*'},
|
||||||
|
callback = function(ev)
|
||||||
|
vim.diagnostic.open_float(nil, { focus = false })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set diagnostic signs
|
||||||
|
local signs = { Error = ' ', Warning = ' ', Hint = ' ', Information = ' ' }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = 'DiagnosticSign' .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user