Open shreyas-a-s opened 3 months ago
I don't think I'm fully understanding. What is update_in_insert
? It doesn't seem to be an nvim or lsp setting.
It appears to be a lualine specific setting: https://github.com/nvim-lualine/lualine.nvim?tab=readme-ov-file#diagnostics-component-options
Is it known by another name?
@alex-courtis
it's part of configuration options for vim.diagnostic.config()
, see :h vim.diagnostic.Opts
.
@alex-courtis
it's part of configuration options for
vim.diagnostic.config()
, see:h vim.diagnostic.Opts
.
Ah... new in 0.10.
This featurecan be added, although it will have to be behind a 0.10 feature flag.
I'm a little wary of 0.10; there have been a few breaking breaking changes recently.
First of all, thanks for the insights. It made me recheck the things and I was wrong. When it comes to lualine yes it indeed is a separate option. But when it comes to neovim an option does exist but I think lualine uses its own value for implementing it.
This is the option in neovim:
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = false,
}
)
And the thing is, I use neovim 0.9.5 and it works as intended when it comes to neovim buffers. See this video:
https://github.com/nvim-tree/nvim-tree.lua/assets/137637016/9d1627d6-e28f-4212-8503-a0212bf3401a
At first I set the update_in_insert
to false
and see that neovim respects it and doesn't show the diagnostic virtual_text while in insert mode. Then when I set it to true
neovim respects that and shows diagnostic virtual_text even when in insert mode.
Similarly, when it comes to lualine as you have found out, it also have such an option.
What I am hoping is the addition of an option like the one below that kind of brings the feature to nvim-tree:
require("nvim-tree").setup({
diagnostics = {
update_in_insert = false, -- ability to set something like this
},
})
That's quite nice. We do seem to have two different mechanisms to achieve this: vim.diagnostic.config()
(0.10) and the above LSP setting.
Can we implement one mechanism to handle both?
I am not really well versed with the programming implications of adding this feature hence it would be better if you could choose one mechanism that you feel is the best choice to handle both.
Let's build for nvim 0.10 and see if it works for 0.9
We can decide whether to build a 0.9 specific implementation based on the above.
I agree. Since neovim 0.10 is the upcoming release, initial focus should be on it.
Description
By default neovim sets diagnostics
update_in_insert = false
and other plugins (for example lualine) respects it. But somehow, nvim-tree doesn't.Neovim version
Operating system and version
Debian 12 Stable (Linux 6.1.0-18-amd64)
Windows variant
No response
nvim-tree version
707b24a
Clean room replication
Steps to reproduce
nvt-min.lua
.nvim -nu nvt-min.lua
.:NvimTreeToggle
.update_in_insert = false
.Expected behavior
Nvim-tree respects the value of
update_in_insert
set by neovim.Actual behavior
https://github.com/nvim-tree/nvim-tree.lua/assets/137637016/142b382d-c6b1-4669-9452-4575dcd780d4
As you can see, when I am creating an error in insert mode, lualine don't update the status but nvim-tree does.
I have checked the docs, issues and discussions and couldn't find anything related to it.