-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Ignore disabled diagnostics #816
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sidequestboy this looks good to me but the method you are using is_disabled
was only added in nvim v0.9.0
so if I merge this anyone on an older version of neovim will have issues. Can you add a check here to ensure that that method exists before using it, if not don't use it.
lua/bufferline/diagnostics.lua
Outdated
@@ -70,8 +70,10 @@ local get_diagnostics = { | |||
nvim_lsp = function() | |||
local results = {} | |||
local diagnostics = vim.diagnostic.get() | |||
-- is_disabled introduced in 0.9 | |||
local is_new_nvim = fn.has("nvim-0.9") > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sidequestboy I think this can be simplified and made more robust by just checking that the function exists. This is what I do elsewhere e.g.
if vim.diagnostic.is_disabled ~= nil
rather than checking for the specific version. Also would be good to have a TODO comment for the future so I can come in and remove this eventually 🙏🏾
thanks for catching that, lmk if this looks good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏾 thanks for tweaking this
* Ignore disabled diagnostics * Add nil check to vim.diagnostic.is_disabled
No description provided.