0

Here are two screenshots, with vim and neovim, both with configured language server protocol and showing same file:

Neovim: neovim

Vim: vim

I want to configure neovim to have same style as vim -- I do not like warning message to appear mixed with my code. What is the name of the option?

2
2

As far as I can tell the term for that feature is inline diagnostics. I don't see any obvious source (like neovim help) for an answer to how to disable it but I found these two possible solutions:

vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
    vim.lsp.diagnostic.on_publish_diagnostics, {
        virtual_text = false
    }
)

Source: How to disable inline buffer error messages?

lua << EOF
  local nvim_lsp = require'nvim_lsp'
  -- Disable Diagnostcs globally
  vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end
EOF

Source: [Neovim LSP] How to disable diagnostics?

Note: I modified the second answer slightly as the original used a deprecated variable name.

Update: Feedback from OP as follows...

The first solution removes the inline diagnostics. You can get diagnostics in a floating window with command vim.lsp.diagnostic.show_line_diagnostics().

The GitHub page for LSP client configuration shows this mapping for that command:

buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)

Finally, apparently the first solution above can also be found here: :help lsp-handler.

7
  • Second one does not work for me -- there is no such thing as vim.lsp.callbacks. And if I replace it with vim.lsp.handlers, mark in left columns disappears fully.
    – KAction
    Mar 27 at 16:55
  • First approach works -- inline text disappears, mark on the left stays. I get see message in pop-up menu via vim.lsp.diagnostic.show_line_diagnostics(). Not exactly the same as in vim, but good enough for my needs.
    – KAction
    Mar 27 at 16:56
  • Now it looks like this: asciinema.org/a/oFpPE1LqZFbE6Lqc1W8ShPGL1
    – KAction
    Mar 27 at 17:04
  • You may want to add it into your answer for future readers. I mapped "<space>e" as instructed here: github.com/neovim/nvim-lspconfig
    – KAction
    Mar 27 at 17:06
  • First answer could be found starting from ":help lsp-handler".
    – KAction
    Mar 27 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.