diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2021-10-17 08:18:35 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 07:18:35 -0700 |
commit | d2d30dfabdaacfd53b081354248402c797576482 (patch) | |
tree | 74f47005521367951803f1275b82aac37b4b0d4f /runtime/doc | |
parent | 30af69509dc91552dc41451857b18907f018c1bd (diff) | |
download | rneovim-d2d30dfabdaacfd53b081354248402c797576482.tar.gz rneovim-d2d30dfabdaacfd53b081354248402c797576482.tar.bz2 rneovim-d2d30dfabdaacfd53b081354248402c797576482.zip |
fix(diagnostic): do not override existing config settings #16043
When using `true` as the value of a configuration option, the option is
configured to use default values. For example, if a user configures
virtual text to include the source globally (using
vim.diagnostic.config) and a specific namespace or producer configures
virtual text with `virt_text = true`, the user's global configuration is
overriden.
Instead, interpret a value of `true` to mean "use existing settings if
defined, otherwise use defaults".
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/diagnostic.txt | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 75c8a2ad6f..17d317522b 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -254,12 +254,31 @@ config({opts}, {namespace}) *vim.diagnostic.config()* Configure diagnostic options globally or for a specific diagnostic namespace. + Configuration can be specified globally, per-namespace, or + ephemerally (i.e. only for a single call to + |vim.diagnostic.set()| or |vim.diagnostic.show()|). Ephemeral + configuration has highest priority, followed by namespace + configuration, and finally global configuration. + + For example, if a user enables virtual text globally with > + + vim.diagnostic.config({virt_text = true}) +< + + and a diagnostic producer sets diagnostics with > + + vim.diagnostic.set(ns, 0, diagnostics, {virt_text = false}) +< + + then virtual text will not be enabled for those diagnostics. + Note: Each of the configuration options below accepts one of the following: • `false` : Disable this feature • `true` : Enable this feature, use default settings. - • `table` : Enable this feature with overrides. + • `table` : Enable this feature with overrides. Use an + empty table to use default values. • `function` : Function with signature (namespace, bufnr) that returns any of the above. @@ -460,8 +479,9 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults}) For example, consider a line of output from a linter: > WARNING filename:27:3: Variable 'foo' does not exist +< - < This can be parsed into a diagnostic |diagnostic-structure| + This can be parsed into a diagnostic |diagnostic-structure| with: > local s = "WARNING filename:27:3: Variable 'foo' does not exist" |