mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
feat(diagnostic): add format
option to setloclist
/setqflist
(#33977)
This commit is contained in:

committed by
GitHub

parent
c681336e3c
commit
2f24ae8de4
@@ -909,6 +909,9 @@ local function set_list(loclist, opts)
|
||||
-- Don't clamp line numbers since the quickfix list can already handle line
|
||||
-- numbers beyond the end of the buffer
|
||||
local diagnostics = get_diagnostics(bufnr, opts --[[@as vim.diagnostic.GetOpts]], false)
|
||||
if opts.format then
|
||||
diagnostics = reformat_diagnostics(opts.format, diagnostics)
|
||||
end
|
||||
local items = M.toqflist(diagnostics)
|
||||
local qf_id = nil
|
||||
if loclist then
|
||||
@@ -2361,6 +2364,11 @@ end
|
||||
---
|
||||
--- See |diagnostic-severity|.
|
||||
--- @field severity? vim.diagnostic.SeverityFilter
|
||||
---
|
||||
--- A function that takes a diagnostic as input and returns a string or nil.
|
||||
--- If the return value is nil, the diagnostic is not displayed in the quickfix list.
|
||||
--- Else the output text is used to display the diagnostic.
|
||||
--- @field format? fun(diagnostic:vim.Diagnostic): string?
|
||||
|
||||
--- Add all diagnostics to the quickfix list.
|
||||
---
|
||||
@@ -2389,6 +2397,11 @@ end
|
||||
---
|
||||
--- See |diagnostic-severity|.
|
||||
--- @field severity? vim.diagnostic.SeverityFilter
|
||||
---
|
||||
--- A function that takes a diagnostic as input and returns a string or nil.
|
||||
--- If the return value is nil, the diagnostic is not displayed in the location list.
|
||||
--- Else the output text is used to display the diagnostic.
|
||||
--- @field format? fun(diagnostic:vim.Diagnostic): string?
|
||||
|
||||
--- Add buffer diagnostics to the location list.
|
||||
---
|
||||
|
Reference in New Issue
Block a user