aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYochem van Rosmalen <git@yochem.nl>2024-11-29 19:07:08 +0100
committerGitHub <noreply@github.com>2024-11-29 10:07:08 -0800
commit2833925cfc688786759d6a980a1ad62b62d20570 (patch)
tree6040556a42632eb55d2133dd7b0e7a71c1149177
parent3056115785a435f89d11551e1c8bb4c89c90f610 (diff)
downloadrneovim-2833925cfc688786759d6a980a1ad62b62d20570.tar.gz
rneovim-2833925cfc688786759d6a980a1ad62b62d20570.tar.bz2
rneovim-2833925cfc688786759d6a980a1ad62b62d20570.zip
docs(diagnostics): location list / quickfix example #31371
-rw-r--r--runtime/doc/diagnostic.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 9ccc3102b6..eaa3681caa 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -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*