feat(action): add type into qf entry when calling entry_to_qf function (#2897)
This commit is contained in:
@@ -912,6 +912,7 @@ local entry_to_qf = function(entry)
|
|||||||
lnum = vim.F.if_nil(entry.lnum, 1),
|
lnum = vim.F.if_nil(entry.lnum, 1),
|
||||||
col = vim.F.if_nil(entry.col, 1),
|
col = vim.F.if_nil(entry.col, 1),
|
||||||
text = text,
|
text = text,
|
||||||
|
type = entry.qf_type,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1121,12 +1121,12 @@ end
|
|||||||
function make_entry.gen_from_diagnostics(opts)
|
function make_entry.gen_from_diagnostics(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|
||||||
|
local type_diagnostic = vim.diagnostic.severity
|
||||||
local signs = (function()
|
local signs = (function()
|
||||||
if opts.no_sign then
|
if opts.no_sign then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local signs = {}
|
local signs = {}
|
||||||
local type_diagnostic = vim.diagnostic.severity
|
|
||||||
for _, severity in ipairs(type_diagnostic) do
|
for _, severity in ipairs(type_diagnostic) do
|
||||||
local status, sign = pcall(function()
|
local status, sign = pcall(function()
|
||||||
-- only the first char is upper all others are lowercalse
|
-- only the first char is upper all others are lowercalse
|
||||||
@@ -1183,6 +1183,13 @@ function make_entry.gen_from_diagnostics(opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local errlist_type_map = {
|
||||||
|
[type_diagnostic.ERROR] = "E",
|
||||||
|
[type_diagnostic.WARN] = "W",
|
||||||
|
[type_diagnostic.INFO] = "I",
|
||||||
|
[type_diagnostic.HINT] = "N",
|
||||||
|
}
|
||||||
|
|
||||||
return function(entry)
|
return function(entry)
|
||||||
return make_entry.set_default_entry_mt({
|
return make_entry.set_default_entry_mt({
|
||||||
value = entry,
|
value = entry,
|
||||||
@@ -1193,6 +1200,7 @@ function make_entry.gen_from_diagnostics(opts)
|
|||||||
lnum = entry.lnum,
|
lnum = entry.lnum,
|
||||||
col = entry.col,
|
col = entry.col,
|
||||||
text = entry.text,
|
text = entry.text,
|
||||||
|
qf_type = errlist_type_map[type_diagnostic[entry.type]],
|
||||||
}, opts)
|
}, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user