Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: diagnostics can easily get out of date #923

Closed
1 task done
gepbird opened this issue Jun 10, 2024 · 2 comments · Fixed by #932
Closed
1 task done

[Bug]: diagnostics can easily get out of date #923

gepbird opened this issue Jun 10, 2024 · 2 comments · Fixed by #932
Labels
bug Something isn't working

Comments

@gepbird
Copy link
Contributor

gepbird commented Jun 10, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Bufferline doesn't update when diagnostics change, it can say there are errors when there aren't or vice versa. This is very annoying when using an lsp formatter to fix style errors and seeing that bufferline reports there are still errors (are those actual errors or those errors are outdated? I have to update bufferline to find it out).

With this minimal config, when I delete the erroneous line with dd, bufferline still shows the warning until I update it with :.

2024-06-10.12-59-46.mp4

What did you expect to happen?

Bufferline also updates when diagnostics changes.

Config

require 'lspconfig'.lua_ls.setup {}
require 'bufferline'.setup {
  options = {
    diagnostics = 'nvim_lsp',
  },
}

Additional Information

Setting options.diagnostics_update_in_insert = true for bufferline doesn't solve this issue.

After debugging this issue, I found out that neovim doesn't refresh the tabline when diagnostics change. Bufferline could refresh it, see :h diagnostic-handlers. This would make diagnostic_update_in_insert deprecated if it was trying to fix this kind of issue. But if diagnostic_update_in_insert was introduced to allow reducing tabline redraws, we could introduce an option like diagnostic_update_on_change. Please let me know which solution we should go with, I'd be happy to make a PR!

commit

99337f6

@gepbird gepbird added the bug Something isn't working label Jun 10, 2024
@akinsho
Copy link
Owner

akinsho commented Jun 25, 2024

Hi @gepbird just got round to this. I'd be up for an optional change to redraw the tabline when using diagnostic handlers. Personally I've never had an issue with this but seems valuable as an option

@gepbird
Copy link
Contributor Author

gepbird commented Jun 25, 2024

Thanks for your response! I'll submit a PR soon with an option called diagnostic_update_on_event. I used a hacked-in version of the proposed change since I opened this issue and had no problems with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants