'Nvim lsp - change lspconfig diagnostic message location

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: enter image description here

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!



Solution 1:[1]

I'v find out myself, in lua config, the <cmd>lua vim.lsp.diagnostic.show_line_diagnostics() show the full diagnostics in a floating window: enter image description here

i just binded the cmd to <space>e as shown in the lspconfig github 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

Solution 2:[2]

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

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 mrded