Hi creator of this here (except someone has 1:1 created the same without me knowing)
Actually everything is just diagnostic for float (in vim.diagnostic.confhere.
Everything except the custom error messages is actually quite simple to do and also kinda stable I think.
focusable = false,
border = border,
scope = "cursor",
header = { "Cursor Diagnostics:", "DiagnosticHeader" },
pos = 1,
prefix = function(diagnostic, i, total)
local icon, highlight
if diagnostic.severity == 1 then
icon = ""
highlight = "DiagnosticError"
elseif diagnostic.severity == 2 then
icon = ""
highlight = "DiagnosticWarn"
elseif diagnostic.severity == 3 then
icon = ""
highlight = "DiagnosticInfo"
elseif diagnostic.severity == 4 then
icon = ""
highlight = "DiagnosticHint"
end
return i .. "/" .. total .. " " .. icon .. " ", highlight
end,
The custom message are a bit trickier and also not so stable I think.
You can specify a function with diagnostic as parameter as format option for the float config.
A diagnostic looks like this:
{
bufnr = 1,
col = 0,
end_col = 1,
end_lnum = 54,
lnum = 54,
message = "Global variable in lowercase initial, Did you miss `local` or misspell it?",
namespace = 10,
severity = 3,
source = "Lua Diagnostics.",
user_data = {
lsp = {
code = "lowercase-global"
}
}
}
So I just wrote some files with a lot of errors in different filetypes, searched for similar errors and grouped together the user_data.lsp.code (notice that not all servers provide this) values and put a message for each group into a table.
Then I loop through this an check if the diagnostic of the float that opens matches one of the groups and then return that message. the table
But as I said the custom messages aren’t possible for all the language servers and all have do be done manually by hand.