mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat(diagnostic): allow retrieving current diagnostic config
This commit is contained in:
parent
8a27205d09
commit
c915571b99
@ -334,8 +334,9 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
|
|||||||
that returns any of the above.
|
that returns any of the above.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{opts} table Configuration table with the following
|
{opts} table|nil When omitted or "nil", retrieve the
|
||||||
keys:
|
current configuration. Otherwise, a
|
||||||
|
configuration table with the following keys:
|
||||||
• underline: (default true) Use underline for
|
• underline: (default true) Use underline for
|
||||||
diagnostics. Options:
|
diagnostics. Options:
|
||||||
• severity: Only underline diagnostics
|
• severity: Only underline diagnostics
|
||||||
|
@ -552,7 +552,8 @@ end
|
|||||||
--- - `table`: Enable this feature with overrides. Use an empty table to use default values.
|
--- - `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.
|
--- - `function`: Function with signature (namespace, bufnr) that returns any of the above.
|
||||||
---
|
---
|
||||||
---@param opts table Configuration table with the following keys:
|
---@param 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 diagnostics. Options:
|
--- - underline: (default true) Use underline for diagnostics. Options:
|
||||||
--- * severity: Only underline diagnostics matching the given severity
|
--- * severity: Only underline diagnostics matching the given severity
|
||||||
--- |diagnostic-severity|
|
--- |diagnostic-severity|
|
||||||
@ -599,7 +600,7 @@ end
|
|||||||
--- global diagnostic options.
|
--- global diagnostic options.
|
||||||
function M.config(opts, namespace)
|
function M.config(opts, namespace)
|
||||||
vim.validate {
|
vim.validate {
|
||||||
opts = { opts, 't' },
|
opts = { opts, 't', true },
|
||||||
namespace = { namespace, 'n', true },
|
namespace = { namespace, 'n', true },
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,6 +612,11 @@ function M.config(opts, namespace)
|
|||||||
t = global_diagnostic_options
|
t = global_diagnostic_options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not opts then
|
||||||
|
-- Return current config
|
||||||
|
return vim.deepcopy(t)
|
||||||
|
end
|
||||||
|
|
||||||
for k, v in pairs(opts) do
|
for k, v in pairs(opts) do
|
||||||
t[k] = v
|
t[k] = v
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user