aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/diagnostic.txt
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-10-11 19:00:52 +0000
committerJosh Rahm <rahm@google.com>2022-10-11 19:00:52 +0000
commit21e2e46242033c7aaa6ccfb23e256680816c063c (patch)
treef089522cfb145d6e9c8a86a01d8e454ce5501e20 /runtime/doc/diagnostic.txt
parent179d3ed87b17988f5fe00d8b99f2611a28212be7 (diff)
parent760b399f6c0c6470daa0663752bd22886997f9e6 (diff)
downloadrneovim-floattitle.tar.gz
rneovim-floattitle.tar.bz2
rneovim-floattitle.zip
Merge remote-tracking branch 'upstream/master' into floattitlefloattitle
Diffstat (limited to 'runtime/doc/diagnostic.txt')
-rw-r--r--runtime/doc/diagnostic.txt86
1 files changed, 47 insertions, 39 deletions
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index e1b52746be..828093ddd4 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -295,10 +295,18 @@ option in the "signs" table of |vim.diagnostic.config()| or 10 if unset).
EVENTS *diagnostic-events*
*DiagnosticChanged*
-DiagnosticChanged After diagnostics have changed.
+DiagnosticChanged After diagnostics have changed. When used from Lua,
+ the new diagnostics are passed to the autocmd
+ callback in the "data" table.
Example: >
- autocmd DiagnosticChanged * lua vim.diagnostic.setqflist({ open = false })
+
+ vim.api.nvim_create_autocmd('DiagnosticChanged', {
+ callback = function(args)
+ local diagnostics = args.data.diagnostics
+ vim.pretty_print(diagnostics)
+ end,
+ })
<
==============================================================================
Lua module: vim.diagnostic *diagnostic-api*
@@ -334,7 +342,7 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
any of the above.
Parameters: ~
- {opts} (table|nil) When omitted or "nil", retrieve the current
+ • {opts} (table|nil) When omitted or "nil", retrieve the current
configuration. Otherwise, a configuration table with the
following keys:
• underline: (default true) Use underline for
@@ -389,32 +397,32 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
severities are displayed before lower severities (e.g.
ERROR is displayed before WARN). Options:
• reverse: (boolean) Reverse sort order
- {namespace} (number|nil) Update the options for the given namespace.
+ • {namespace} (number|nil) Update the options for the given namespace.
When omitted, update the global diagnostic options.
disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer.
Parameters: ~
- {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
+ • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, disable diagnostics in all buffers.
- {namespace} (number|nil) Only disable diagnostics for the given
+ • {namespace} (number|nil) Only disable diagnostics for the given
namespace.
enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer.
Parameters: ~
- {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
+ • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, enable diagnostics in all buffers.
- {namespace} (number|nil) Only enable diagnostics for the given
+ • {namespace} (number|nil) Only enable diagnostics for the given
namespace.
fromqflist({list}) *vim.diagnostic.fromqflist()*
Convert a list of quickfix items to a list of diagnostics.
Parameters: ~
- {list} (table) A list of quickfix items from |getqflist()| or
+ • {list} (table) A list of quickfix items from |getqflist()| or
|getloclist()|.
Return: ~
@@ -424,9 +432,9 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics.
Parameters: ~
- {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for
+ • {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for
current buffer or nil for all buffers.
- {opts} (table|nil) A table with the following keys:
+ • {opts} (table|nil) A table with the following keys:
• namespace: (number) Limit diagnostics to the given
namespace.
• lnum: (number) Limit diagnostics to the given line number.
@@ -439,7 +447,7 @@ get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata.
Parameters: ~
- {namespace} (number) Diagnostic namespace
+ • {namespace} (number) Diagnostic namespace
Return: ~
(table) Namespace metadata
@@ -454,7 +462,7 @@ get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position.
Parameters: ~
- {opts} (table) See |vim.diagnostic.goto_next()|
+ • {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
(table) Next diagnostic
@@ -463,7 +471,7 @@ get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
Return the position of the next diagnostic in the current buffer.
Parameters: ~
- {opts} (table) See |vim.diagnostic.goto_next()|
+ • {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
(table) Next diagnostic position as a (row, col) tuple.
@@ -472,7 +480,7 @@ get_prev({opts}) *vim.diagnostic.get_prev()*
Get the previous diagnostic closest to the cursor position.
Parameters: ~
- {opts} (table) See |vim.diagnostic.goto_next()|
+ • {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
(table) Previous diagnostic
@@ -481,7 +489,7 @@ get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
Return the position of the previous diagnostic in the current buffer.
Parameters: ~
- {opts} (table) See |vim.diagnostic.goto_next()|
+ • {opts} (table) See |vim.diagnostic.goto_next()|
Return: ~
(table) Previous diagnostic position as a (row, col) tuple.
@@ -490,7 +498,7 @@ goto_next({opts}) *vim.diagnostic.goto_next()*
Move to the next diagnostic.
Parameters: ~
- {opts} (table|nil) Configuration table with the following keys:
+ • {opts} (table|nil) Configuration table with the following keys:
• namespace: (number) Only consider diagnostics from the given
namespace.
• cursor_position: (cursor position) Cursor position as a
@@ -511,7 +519,7 @@ goto_prev({opts}) *vim.diagnostic.goto_prev()*
Move to the previous diagnostic in the current buffer.
Parameters: ~
- {opts} (table) See |vim.diagnostic.goto_next()|
+ • {opts} (table) See |vim.diagnostic.goto_next()|
hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics.
@@ -524,9 +532,9 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|.
Parameters: ~
- {namespace} (number|nil) Diagnostic namespace. When omitted, hide
+ • {namespace} (number|nil) Diagnostic namespace. When omitted, hide
diagnostics from all namespaces.
- {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
+ • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, hide diagnostics in all buffers.
*vim.diagnostic.match()*
@@ -547,13 +555,13 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
<
Parameters: ~
- {str} (string) String to parse diagnostics from.
- {pat} (string) Lua pattern with capture groups.
- {groups} (table) List of fields in a |diagnostic-structure| to
+ • {str} (string) String to parse diagnostics from.
+ • {pat} (string) Lua pattern with capture groups.
+ • {groups} (table) List of fields in a |diagnostic-structure| to
associate with captures from {pat}.
- {severity_map} (table) A table mapping the severity field from
+ • {severity_map} (table) A table mapping the severity field from
{groups} with an item from |vim.diagnostic.severity|.
- {defaults} (table|nil) Table of default values for any fields not
+ • {defaults} (table|nil) Table of default values for any fields not
listed in {groups}. When omitted, numeric values
default to 0 and "severity" defaults to ERROR.
@@ -565,7 +573,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window.
Parameters: ~
- {opts} (table|nil) Configuration table with the same keys as
+ • {opts} (table|nil) Configuration table with the same keys as
|vim.lsp.util.open_floating_preview()| in addition to the
following:
• bufnr: (number) Buffer number to show diagnostics from.
@@ -623,27 +631,27 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
re-displayed, use |vim.diagnostic.hide()|.
Parameters: ~
- {namespace} (number|nil) Diagnostic namespace. When omitted, remove
+ • {namespace} (number|nil) Diagnostic namespace. When omitted, remove
diagnostics from all namespaces.
- {bufnr} (number|nil) Remove diagnostics for the given buffer.
+ • {bufnr} (number|nil) Remove diagnostics for the given buffer.
When omitted, diagnostics are removed for all buffers.
set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer.
Parameters: ~
- {namespace} (number) The diagnostic namespace
- {bufnr} (number) Buffer number
- {diagnostics} (table) A list of diagnostic items
+ • {namespace} (number) The diagnostic namespace
+ • {bufnr} (number) Buffer number
+ • {diagnostics} (table) A list of diagnostic items
|diagnostic-structure|
- {opts} (table|nil) Display options to pass to
+ • {opts} (table|nil) Display options to pass to
|vim.diagnostic.show()|
setloclist({opts}) *vim.diagnostic.setloclist()*
Add buffer diagnostics to the location list.
Parameters: ~
- {opts} (table|nil) Configuration table with the following keys:
+ • {opts} (table|nil) Configuration table with the following keys:
• namespace: (number) Only add diagnostics from the given
namespace.
• winnr: (number, default 0) Window number to set location
@@ -658,7 +666,7 @@ setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list.
Parameters: ~
- {opts} (table|nil) Configuration table with the following keys:
+ • {opts} (table|nil) Configuration table with the following keys:
• namespace: (number) Only add diagnostics from the given
namespace.
• open: (boolean, default true) Open quickfix list after
@@ -672,17 +680,17 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer.
Parameters: ~
- {namespace} (number|nil) Diagnostic namespace. When omitted, show
+ • {namespace} (number|nil) Diagnostic namespace. When omitted, show
diagnostics from all namespaces.
- {bufnr} (number|nil) Buffer number, or 0 for current buffer.
+ • {bufnr} (number|nil) Buffer number, or 0 for current buffer.
When omitted, show diagnostics in all buffers.
- {diagnostics} (table|nil) The diagnostics to display. When omitted,
+ • {diagnostics} (table|nil) The diagnostics to display. When omitted,
use the saved diagnostics for the given namespace and
buffer. This can be used to display a list of
diagnostics without saving them or to display only a
subset of diagnostics. May not be used when {namespace}
or {bufnr} is nil.
- {opts} (table|nil) Display options. See
+ • {opts} (table|nil) Display options. See
|vim.diagnostic.config()|.
toqflist({diagnostics}) *vim.diagnostic.toqflist()*
@@ -690,7 +698,7 @@ toqflist({diagnostics}) *vim.diagnostic.toqflist()*
passed to |setqflist()| or |setloclist()|.
Parameters: ~
- {diagnostics} (table) List of diagnostics |diagnostic-structure|.
+ • {diagnostics} (table) List of diagnostics |diagnostic-structure|.
Return: ~
array of quickfix list items |setqflist-what|