Closed WhyNotHugo closed 2 years ago
I had a similar thing happening for me and it was because get_diagnostic
was returning a nil
and I wasn't handling that correctly - in my case I was trying to concat it.
I had a similar thing happening for me and it was because get_diagnostic was returning a nil and I wasn't handling that correctly - in my case I was trying to concat it.
This PR explicitly changed the API to always return a number (in my case, I display info + hint
). This was merged into this fork at some point, though history was squashed.
Upon looking closer at the above commit, it seems it broke this expectation; these methods now return a string, and integer or nil, which is really hard to work with since it requires handling and casting all scenarios any place these are called.
Given that it has [AFAIK] no functional changes, maybe it's best to just revert it?
Actually, it seems this was partially broken before, but it's only this particular commit that affects my own setup.
Oh, there were two issues, one in my local config, and another in the above commit. My local code had to be updated with:
-- Return the formatted sum of INFO and HINT diagnostics.
---@return string
local function get_diagnostic_info()
local count = 0
- for _, type in ipairs({ "Hint", "Information" }) do
+ for _, type in ipairs({ vim.diagnostic.severity.HINT, vim.diagnostic.severity.INFO }) do
count = count + diagnostic.get_diagnostic(type)
end
When opening any file with diagnostics, I'm seeing this error:
Bisection indicates that 3b9d3f0b4592168baefa5838d943963336bc6a40 introduced this regression.
I'm not sure how to get the full error output though; the above is probably not helpful enough.