mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
fix(diagnostic): deprecate float
in vim.diagnostic.Opts.Jump
(#34037)
This commit is contained in:
@ -21,7 +21,8 @@ API
|
||||
|
||||
DIAGNOSTICS
|
||||
|
||||
• "float" in |vim.diagnostic.JumpOpts|. Use "on_jump" instead.
|
||||
• "float" in |vim.diagnostic.JumpOpts|. Use "on_jump" instead.
|
||||
• "float" in |vim.diagnostic.Opts.Jump|. Use "on_jump" instead.
|
||||
|
||||
HIGHLIGHTS
|
||||
|
||||
|
@ -604,8 +604,8 @@ Lua module: vim.diagnostic *diagnostic-api*
|
||||
*vim.diagnostic.Opts.Jump*
|
||||
|
||||
Fields: ~
|
||||
• {float}? (`boolean|vim.diagnostic.Opts.Float`, default: false)
|
||||
Default value of the {float} parameter of
|
||||
• {on_jump}? (`fun(diagnostic:vim.Diagnostic?, bufnr:integer)`)
|
||||
Default value of the {on_jump} parameter of
|
||||
|vim.diagnostic.jump()|.
|
||||
• {wrap}? (`boolean`, default: true) Default value of the {wrap}
|
||||
parameter of |vim.diagnostic.jump()|.
|
||||
|
@ -288,9 +288,8 @@ end
|
||||
|
||||
--- @class vim.diagnostic.Opts.Jump
|
||||
---
|
||||
--- Default value of the {float} parameter of |vim.diagnostic.jump()|.
|
||||
--- (default: false)
|
||||
--- @field float? boolean|vim.diagnostic.Opts.Float
|
||||
--- Default value of the {on_jump} parameter of |vim.diagnostic.jump()|.
|
||||
--- @field on_jump? fun(diagnostic:vim.Diagnostic?, bufnr:integer)
|
||||
---
|
||||
--- Default value of the {wrap} parameter of |vim.diagnostic.jump()|.
|
||||
--- (default: true)
|
||||
@ -346,9 +345,6 @@ local global_diagnostic_options = {
|
||||
update_in_insert = false,
|
||||
severity_sort = false,
|
||||
jump = {
|
||||
-- Do not show floating window
|
||||
float = false,
|
||||
|
||||
-- Wrap around buffer
|
||||
wrap = true,
|
||||
},
|
||||
@ -1158,6 +1154,25 @@ function M.config(opts, namespace)
|
||||
return vim.deepcopy(t, true)
|
||||
end
|
||||
|
||||
if opts.jump and opts.jump.float ~= nil then ---@diagnostic disable-line
|
||||
vim.deprecate('opts.jump.float', 'opts.jump.on_jump', '0.14')
|
||||
|
||||
local float_opts = opts.jump.float ---@type table|boolean
|
||||
if float_opts then
|
||||
float_opts = type(float_opts) == 'table' and float_opts or {}
|
||||
|
||||
opts.jump.on_jump = function(_, bufnr)
|
||||
M.open_float(vim.tbl_extend('keep', float_opts, {
|
||||
bufnr = bufnr,
|
||||
scope = 'cursor',
|
||||
focus = false,
|
||||
}))
|
||||
end
|
||||
end
|
||||
|
||||
opts.jump.float = nil ---@diagnostic disable-line
|
||||
end
|
||||
|
||||
for k, v in
|
||||
pairs(opts --[[@as table<any,any>]])
|
||||
do
|
||||
|
Reference in New Issue
Block a user