aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2021-11-04 06:59:24 -0600
committerGitHub <noreply@github.com>2021-11-04 06:59:24 -0600
commitfd347840ba95b2709b90d5a3131f59b72fbad7fb (patch)
treec475b8c2e9fbbbe94c32d3c01cb587a838074ba5 /runtime/lua/vim/diagnostic.lua
parentf26b391317281d0520056eaa8312cf25e654149f (diff)
downloadrneovim-fd347840ba95b2709b90d5a3131f59b72fbad7fb.tar.gz
rneovim-fd347840ba95b2709b90d5a3131f59b72fbad7fb.tar.bz2
rneovim-fd347840ba95b2709b90d5a3131f59b72fbad7fb.zip
fix(diagnostic): fix option resolution in open_float (#16229)
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r--runtime/lua/vim/diagnostic.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 19cad3cec8..911d482bfd 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -1154,6 +1154,17 @@ function M.open_float(bufnr, opts)
error("Invalid value for option 'scope'")
end
+ do
+ -- Resolve options with user settings from vim.diagnostic.config
+ -- Unlike the other decoration functions (e.g. set_virtual_text, set_signs, etc.) `open_float`
+ -- does not have a dedicated table for configuration options; instead, the options are mixed in
+ -- with its `opts` table which also includes "keyword" parameters. So we create a dedicated
+ -- options table that inherits missing keys from the global configuration before resolving.
+ local t = global_diagnostic_options.float
+ local float_opts = vim.tbl_extend("keep", opts, type(t) == "table" and t or {})
+ opts = get_resolved_options({ float = float_opts }, nil, bufnr).float
+ end
+
local diagnostics = M.get(bufnr, opts)
clamp_line_numbers(bufnr, diagnostics)
@@ -1184,17 +1195,6 @@ function M.open_float(bufnr, opts)
end
end
- do
- -- Resolve options with user settings from vim.diagnostic.config
- -- Unlike the other decoration functions (e.g. set_virtual_text, set_signs, etc.) `open_float`
- -- does not have a dedicated table for configuration options; instead, the options are mixed in
- -- with its `opts` table which also includes "keyword" parameters. So we create a dedicated
- -- options table that inherits missing keys from the global configuration before resolving.
- local t = global_diagnostic_options.float
- local float_opts = vim.tbl_extend("keep", opts, type(t) == "table" and t or {})
- opts = get_resolved_options({ float = float_opts }, nil, bufnr).float
- end
-
local lines = {}
local highlights = {}
local show_header = vim.F.if_nil(opts.show_header, true)