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

Ignore disabled diagnostics #816

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Ignore disabled diagnostics #816

merged 2 commits into from
Sep 20, 2023

Conversation

sidequestboy
Copy link
Contributor

No description provided.

Copy link
Owner

@akinsho akinsho left a 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.

@@ -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
Copy link
Owner

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 🙏🏾

@sidequestboy
Copy link
Contributor Author

thanks for catching that, lmk if this looks good

Copy link
Owner

@akinsho akinsho left a 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

@akinsho akinsho merged commit 8a51c4b into akinsho:main Sep 20, 2023
1 check failed
sstallion pushed a commit to sstallion/bufferline.nvim that referenced this pull request Jul 3, 2024
* Ignore disabled diagnostics

* Add nil check to vim.diagnostic.is_disabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants