mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
docs(diagnostics): location list / quickfix example #31371
This commit is contained in:
parent
3056115785
commit
2833925cfc
@ -163,6 +163,33 @@ show a sign for the highest severity diagnostic on a given line: >lua
|
||||
}
|
||||
<
|
||||
|
||||
*diagnostic-loclist-example*
|
||||
Whenever the |location-list| is opened, the following `show` handler will show
|
||||
the most recent diagnostics: >lua
|
||||
|
||||
vim.diagnostic.handlers.loclist = {
|
||||
show = function(_, _, _, opts)
|
||||
-- Generally don't want it to open on every update
|
||||
opts.loclist.open = opts.loclist.open or false
|
||||
local winid = vim.api.nvim_get_current_win()
|
||||
vim.diagnostic.setloclist(opts.loclist)
|
||||
vim.api.nvim_set_current_win(winid)
|
||||
end
|
||||
}
|
||||
<
|
||||
|
||||
The handler accepts the same options as |vim.diagnostic.setloclist()| and can be
|
||||
configured using |vim.diagnostic.config()|: >lua
|
||||
|
||||
-- Open the location list on every diagnostic change (warnings/errors only).
|
||||
vim.diagnostic.config({
|
||||
loclist = {
|
||||
open = true,
|
||||
severity = { min = vim.diagnostic.severity.WARN },
|
||||
}
|
||||
})
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
HIGHLIGHTS *diagnostic-highlights*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user