Reputation: 693
i ran into a problem, when im using neovim (+ lspconfig with hie
set up), i have diagnostics info inline, but sometime, i cant read the whole line:
is there a way for me to see the whole message? i searched on the net to find a way to put the message on a floating window/status line when i hover the line, but i couldnt find a solution.
thanks for your help!
Upvotes: 25
Views: 21382
Reputation: 51
Nvim - To fix diagnosis floating window interfering with other floating windows
If you just want to disable the virtual text and invoke the diagnosis floating windows whenever required just add the below lines in your configuration
Manually invoke the floating window by pressing Space
d
vim.diagnostic.config({
virtual_text = false
})
vim.keymap.set("n", "<Leader>d", ":lua vim.diagnostic.open_float(0, {scope='line'})<CR>)
For me Leader
key is Space
key
Upvotes: 1
Reputation: 693
The <cmd>lua vim.lsp.diagnostic.show_line_diagnostics()
command shows the full diagnostics in a floating window:
I bound the command to \<space>e
as shown in the lspconfig github README and everything works fine.
EDIT 9 may 2022: In this commit, vim.lsp.diagnostic.show_line_diagnostics()
changed to vim.diagnostic.open_float()
, thanks @DarthVanger for pointing it out.
Upvotes: 26
Reputation: 5270
To disable inline text, and do a diagnostic window on hover, just put these lines into lsp config:
vim.diagnostic.config({
virtual_text = false
})
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
More info can be found here: https://github.com/neovim/nvim-lspconfig/wiki/UI-Customization
Upvotes: 34