codelenses flash on every keystroke
Describe the bug
When I navigate a file, each j or k keystroke causes codelenses to flash from their resolved state to "Unresolved codelens" and back again.
Expected behaviour
The codelens should preserve it's already resolved value instead of attempting to reload.
Environment (please complete the following information):
- OS: OSX
- Vim / Neovim version: v0.10.2
- dotnet SDK version: 8.0.403
I dug a bit further into neovim issues and found this one https://github.com/neovim/neovim/issues/25242. This is unlikely an ionide issue. Feel free to close unless perhaps there's a known workaround you'd recommend or suspect it could be affected by ionide.
Actually passing let g:fsharp#lsp_codelens = 0 doesn't disable the codelens, but removes the flickering. But when I format the file, the lenses disppear. Maybe this odd behavior is related to https://github.com/ionide/Ionide-vim/issues/77, maybe since the lsp_codelens controls registering of the autocmd, but the server is still sending the lens data?
My way to mitigate the issue is by using this config (this is for Nvim + Lazy)
{
"ionide/ionide-vim",
config = function()
vim.g["fsharp#lsp_codelens"] = 0
vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave" },
{
pattern = { "*.fs", "*.fsx", "*.fsi" },
callback = function()
vim.lsp.codelens.refresh()
end,
-- buffer = 0, -- current buffer
}
)
end
}
This will update the codelens only when leaving the insert mode. It means we don't get automatic update when writing but I find it less distracting.
Also, when formatting the codelens are going to disappear but the next time you leave insert mode they will be back. I didn't find yet a way to attach to the format call
I also added on BufEnter because the codelens could have been impacted by changes made in another file due to type inference