mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(diagnostic): deprecate float
in vim.diagnostic.Opts.Jump
(#34037)
This commit is contained in:
@@ -21,7 +21,8 @@ API
|
|||||||
|
|
||||||
DIAGNOSTICS
|
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
|
HIGHLIGHTS
|
||||||
|
|
||||||
|
@@ -604,8 +604,8 @@ Lua module: vim.diagnostic *diagnostic-api*
|
|||||||
*vim.diagnostic.Opts.Jump*
|
*vim.diagnostic.Opts.Jump*
|
||||||
|
|
||||||
Fields: ~
|
Fields: ~
|
||||||
• {float}? (`boolean|vim.diagnostic.Opts.Float`, default: false)
|
• {on_jump}? (`fun(diagnostic:vim.Diagnostic?, bufnr:integer)`)
|
||||||
Default value of the {float} parameter of
|
Default value of the {on_jump} parameter of
|
||||||
|vim.diagnostic.jump()|.
|
|vim.diagnostic.jump()|.
|
||||||
• {wrap}? (`boolean`, default: true) Default value of the {wrap}
|
• {wrap}? (`boolean`, default: true) Default value of the {wrap}
|
||||||
parameter of |vim.diagnostic.jump()|.
|
parameter of |vim.diagnostic.jump()|.
|
||||||
|
@@ -288,9 +288,8 @@ end
|
|||||||
|
|
||||||
--- @class vim.diagnostic.Opts.Jump
|
--- @class vim.diagnostic.Opts.Jump
|
||||||
---
|
---
|
||||||
--- Default value of the {float} parameter of |vim.diagnostic.jump()|.
|
--- Default value of the {on_jump} parameter of |vim.diagnostic.jump()|.
|
||||||
--- (default: false)
|
--- @field on_jump? fun(diagnostic:vim.Diagnostic?, bufnr:integer)
|
||||||
--- @field float? boolean|vim.diagnostic.Opts.Float
|
|
||||||
---
|
---
|
||||||
--- Default value of the {wrap} parameter of |vim.diagnostic.jump()|.
|
--- Default value of the {wrap} parameter of |vim.diagnostic.jump()|.
|
||||||
--- (default: true)
|
--- (default: true)
|
||||||
@@ -346,9 +345,6 @@ local global_diagnostic_options = {
|
|||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
severity_sort = false,
|
severity_sort = false,
|
||||||
jump = {
|
jump = {
|
||||||
-- Do not show floating window
|
|
||||||
float = false,
|
|
||||||
|
|
||||||
-- Wrap around buffer
|
-- Wrap around buffer
|
||||||
wrap = true,
|
wrap = true,
|
||||||
},
|
},
|
||||||
@@ -1158,6 +1154,25 @@ function M.config(opts, namespace)
|
|||||||
return vim.deepcopy(t, true)
|
return vim.deepcopy(t, true)
|
||||||
end
|
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
|
for k, v in
|
||||||
pairs(opts --[[@as table<any,any>]])
|
pairs(opts --[[@as table<any,any>]])
|
||||||
do
|
do
|
||||||
|
Reference in New Issue
Block a user