4

When I upgrade Neovim 0.8.3 to 0.9.0, the plugin lsp-setup.nvim diagnostic message disappears when the content is entered in insert mode.

After exiting insert mode, the diagnostic message appears again, causing the number line to keep resizing.

set numberwith=6 number line will not change the width constantly, but it will appear again when it exceeds 1000 lines.

Is this a bug? How to keep the diagnostic message in insert mode?

Insert mode and input ';':

enter image description here

Exit insert mode, show diagnostic message, numberwidth changed

enter image description here

The plugin config:

return {
    'junnplus/lsp-setup.nvim',
    event = 'BufRead',
    dependencies = {
        'neovim/nvim-lspconfig',
        'williamboman/mason.nvim',
        'williamboman/mason-lspconfig.nvim',
        'folke/neodev.nvim'
    },
    init = function()
        local rounded = { border = 'rounded' }
        vim.diagnostic.config({ float = rounded })
        vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, rounded)
        vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, rounded)
    end,
    opts = {
        mappings = {
            gd = function() require('telescope.builtin').lsp_definitions() end,
            gi = function() require('telescope.builtin').lsp_implementations() end,
            gr = function() require('telescope.builtin').lsp_references() end,
            ['<space>f'] = vim.lsp.buf.format,
        },
        servers = {
            eslint = {},
            pylsp = {},
            lua_ls = {
                settings = {
                    Lua = {
                        workspace = {
                            checkThirdParty = false,
                        }
                    }
                }
            },
        }
    },
}
5
  • 1
    I'm not sure I understand what you mean by diagnostic message. It would be helpful if you could tell us which plugin is responsible for the message (ALE, coc.nvim, cmp.nvim, ...). It would also be help full if you could provide a short script that highlight the problem together with a screenshot. May 9, 2023 at 6:47
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – D. Ben Knoble
    May 9, 2023 at 12:21
  • Thanks for the screenshots and the script. But we would also need to know what Lua warning message you are using (coc.nvim, ALE, cmp.nvim)? May 9, 2023 at 12:31
  • the gitsigns plugin has same problem github.com/lewis6991/gitsigns.nvim
    – sharp
    May 9, 2023 at 12:56
  • Looks like a bug that need to be discussed with Neovim development team. Maybe could you report the issue to the issue section of the corresponding GitHub project. May 9, 2023 at 13:10

2 Answers 2

2

Try using this config.

vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
  vim.lsp.diagnostic.on_publish_diagnostics, {
    -- delay update diagnostics
    update_in_insert = true,
  }
)

This will get it updating on insert and stop the annoying line movements.

1
  • Welcome to Vi and Vim! Please consider editing your answer to add additional explanation to your code, perhaps by pointing to the relevant documentation?
    – D. Ben Knoble
    May 21, 2023 at 21:00
0

if you are using lazyvim you can change update_in_insert to true

opts = {
...............
  diagnostics = {
    update_in_insert = true, <---------------- change this to true
................
}

https://www.lazyvim.org/plugins/lsp#nvim-lspconfig

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    May 5 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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