diff options
author | Peter Aronoff <peter@aronoff.org> | 2024-07-04 13:15:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-04 12:15:35 -0500 |
commit | 4b3be56a03695fa14ed28d6ded4cb338cbb99249 (patch) | |
tree | d67838245753514da21d792c0b1dcfc5233b3550 /runtime/lua/vim | |
parent | 7e099cf3eb1fd338a3aa50cf23f1b0a1f461f988 (diff) | |
download | rneovim-4b3be56a03695fa14ed28d6ded4cb338cbb99249.tar.gz rneovim-4b3be56a03695fa14ed28d6ded4cb338cbb99249.tar.bz2 rneovim-4b3be56a03695fa14ed28d6ded4cb338cbb99249.zip |
fix(diagnostic): make docs agree with code (#29561)
Problem: the code and docs for vim.diagnostic.JumpOpts.float send mixed
signals about what the default should be. When the option is first set,
in the global_diagnostic_options table, the comment clearly says that
the default is false. Later in the code, in goto_diagnostic, there's
a line that sets the default to true if no default is present. Finally,
the docs say that the default is true.
Solution: Change the docs to reflect the new default of false and fix
the goto_diagnostic function.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 43954358a3..a4280506ab 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -972,9 +972,8 @@ local function goto_diagnostic(diagnostic, opts) vim.cmd('normal! zv') end) - local float = if_nil(opts.float, true) - if float then - local float_opts = type(float) == 'table' and float or {} + if opts.float then + local float_opts = type(opts.float) == 'table' and opts.float or {} vim.schedule(function() M.open_float(vim.tbl_extend('keep', float_opts, { bufnr = api.nvim_win_get_buf(winid), @@ -1271,7 +1270,7 @@ end --- If a table, pass the table as the {opts} parameter to |vim.diagnostic.open_float()|. --- Unless overridden, the float will show diagnostics at the new cursor --- position (as if "cursor" were passed to the "scope" option). ---- (default: `true`) +--- (default: `false`) --- @field float? boolean|vim.diagnostic.Opts.Float --- --- Window ID |