From 953ae71fd324eb1a263d2b7435cc15756b44ac2d Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Tue, 9 Nov 2021 14:33:01 -0700 Subject: feat(diagnostic): do not require namespace for hide() and show() (#16261) Also fix a few other small bugs regarding saving and restoring extmarks. In particular, now that the virtual text and underline handlers have their own dedicated namespaces, they should be responsible for saving and restoring their own extmarks. Also fix the wrong argument ordering in the call to `clear_diagnostic_cache` in the `on_detach` callback. --- runtime/doc/diagnostic.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index d121dba435..e2469b4f4e 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -536,7 +536,9 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()* |vim.diagnostic.disable()|. Parameters: ~ - {namespace} number The diagnostic namespace + {namespace} number|nil Diagnostic namespace. When + omitted, hide diagnostics from all + namespaces. {bufnr} number|nil Buffer number. Defaults to the current buffer. @@ -626,7 +628,9 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()* |vim.diagnostic.hide()|. Parameters: ~ - {namespace} number + {namespace} number|nil Diagnostic namespace. When + omitted, remove diagnostics from all + namespaces. {bufnr} number|nil Remove diagnostics for the given buffer. When omitted, diagnostics are removed for all buffers. @@ -677,7 +681,9 @@ show({namespace}, {bufnr}, {diagnostics}, {opts}) Display diagnostics for the given namespace and buffer. Parameters: ~ - {namespace} number Diagnostic namespace. + {namespace} number|nil Diagnostic namespace. When + omitted, show diagnostics from all + namespaces. {bufnr} number|nil Buffer number. Defaults to the current buffer. {diagnostics} table|nil The diagnostics to display. When @@ -685,7 +691,8 @@ show({namespace}, {bufnr}, {diagnostics}, {opts}) 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. + subset of diagnostics. May not be used when + {namespace} is nil. {opts} table|nil Display options. See |vim.diagnostic.config()|. -- cgit