fix: only validate severity table when using a range (#2709)

The only possibility for having a table with different severities to
pass to `vim.diagnostics.get()` as opts is when setting a range (limit
and bound), so just check for an empty table when a range is set.
This commit is contained in:
Charles Moscofian
2023-09-20 01:55:48 +02:00
committed by GitHub
parent e7cfbb5d1f
commit 40c8d2fc2b

View File

@@ -86,10 +86,10 @@ local diagnostics_to_tbl = function(opts)
if opts.severity_bound ~= nil then
diagnosis_opts.severity["max"] = opts.severity_bound
end
end
if vim.version().minor > 9 and vim.tbl_isempty(diagnosis_opts.severity) then
diagnosis_opts.severity = nil
end
end
opts.root_dir = opts.root_dir == true and vim.loop.cwd() or opts.root_dir