refactor(lua): remove deprecated features #28725

This commit is contained in:
Justin M. Keyes 2024-05-13 05:00:39 -07:00 committed by GitHub
parent b6fdde5224
commit e3ec974324
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 55 deletions

View File

@ -1008,26 +1008,6 @@ function ListIter:enumerate()
return self return self
end end
---@deprecated
function Iter:nextback()
error('Iter:nextback() was renamed to Iter:pop()')
end
---@deprecated
function Iter:peekback()
error('Iter:peekback() was renamed to Iter:rpeek()')
end
---@deprecated
function Iter:skipback()
error('Iter:skipback() was renamed to Iter:rskip()')
end
---@deprecated
function Iter:nthback()
error('Iter:nthback() was removed, use Iter:nth() with negative index')
end
--- Creates a new Iter object from a table or other |iterable|. --- Creates a new Iter object from a table or other |iterable|.
--- ---
---@param src table|function Table or iterator to drain values from ---@param src table|function Table or iterator to drain values from

View File

@ -372,20 +372,9 @@ api.nvim_set_decoration_provider(namespace, {
--- @return boolean --- @return boolean
--- @since 12 --- @since 12
function M.is_enabled(filter) function M.is_enabled(filter)
---@type integer vim.validate({ filter = { filter, 'table', true } })
local bufnr filter = filter or {}
if type(filter) == 'number' then local bufnr = filter.bufnr
vim.deprecate(
'vim.lsp.inlay_hint.is_enabled(bufnr:number)',
'vim.lsp.inlay_hint.is_enabled(filter:table)',
'0.10-dev'
)
bufnr = filter
else
vim.validate({ filter = { filter, 'table', true } })
filter = filter or {}
bufnr = filter.bufnr
end
vim.validate({ bufnr = { bufnr, 'number', true } }) vim.validate({ bufnr = { bufnr, 'number', true } })
if bufnr == nil then if bufnr == nil then
@ -414,15 +403,6 @@ end
--- @param filter vim.lsp.inlay_hint.enable.Filter? --- @param filter vim.lsp.inlay_hint.enable.Filter?
--- @since 12 --- @since 12
function M.enable(enable, filter) function M.enable(enable, filter)
if type(enable) == 'number' or type(filter) == 'boolean' then
vim.deprecate(
'vim.lsp.inlay_hint.enable(bufnr:number, enable:boolean)',
'vim.lsp.inlay_hint.enable(enable:boolean, filter:table)',
'0.10-dev'
)
error('see :help vim.lsp.inlay_hint.enable() for updated parameters')
end
vim.validate({ enable = { enable, 'boolean', true }, filter = { filter, 'table', true } }) vim.validate({ enable = { enable, 'boolean', true }, filter = { filter, 'table', true } })
enable = enable == nil or enable enable = enable == nil or enable
filter = filter or {} filter = filter or {}

View File

@ -601,12 +601,6 @@ function vim.spairs(t)
t t
end end
--- @deprecated
function vim.tbl_isarray()
vim.deprecate('vim.tbl_isarray', 'vim.isarray', '0.10-dev')
error('vim.tbl_isarray was renamed to vim.isarray')
end
--- Tests if `t` is an "array": a table indexed _only_ by integers (potentially non-contiguous). --- Tests if `t` is an "array": a table indexed _only_ by integers (potentially non-contiguous).
--- ---
--- If the indexes start from 1 and are contiguous then the array is also a list. |vim.islist()| --- If the indexes start from 1 and are contiguous then the array is also a list. |vim.islist()|

View File

@ -125,16 +125,14 @@ describe('vim.lsp.inlay_hint', function()
'enable: expected boolean, got table', 'enable: expected boolean, got table',
t.pcall_err(exec_lua, [[vim.lsp.inlay_hint.enable({}, { bufnr = bufnr })]]) t.pcall_err(exec_lua, [[vim.lsp.inlay_hint.enable({}, { bufnr = bufnr })]])
) )
t.matches(
'enable: expected boolean, got number',
t.pcall_err(exec_lua, [[vim.lsp.inlay_hint.enable(42)]])
)
t.matches( t.matches(
'filter: expected table, got number', 'filter: expected table, got number',
t.pcall_err(exec_lua, [[vim.lsp.inlay_hint.enable(true, 42)]]) t.pcall_err(exec_lua, [[vim.lsp.inlay_hint.enable(true, 42)]])
) )
exec_lua [[vim.notify = function() end]]
t.matches(
'see %:help vim%.lsp%.inlay_hint%.enable',
t.pcall_err(exec_lua, [[vim.lsp.inlay_hint.enable(42)]])
)
end) end)
describe('clears/applies inlay hints when passed false/true/nil', function() describe('clears/applies inlay hints when passed false/true/nil', function()