mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
feat(lua): enable(enable:boolean, filter:table) #28374
Problem: We need to establish a pattern for `enable()`. Solution: - First `enable()` parameter is always `enable:boolean`. - Update `vim.diagnostic.enable()` - Update `vim.lsp.inlay_hint.enable()`. - It was not released yet, so no deprecation is needed. But to help HEAD users, it will show an informative error. - vim.deprecate(): - Improve message when the "removal version" is a *current or older* version.
This commit is contained in:
@ -1049,10 +1049,11 @@ function vim.deprecate(name, alternative, version, plugin, backtrace)
|
||||
plugin = { plugin, 'string', true },
|
||||
}
|
||||
plugin = plugin or 'Nvim'
|
||||
local will_be_removed = 'will be removed'
|
||||
|
||||
-- Only issue warning if feature is hard-deprecated as specified by MAINTAIN.md.
|
||||
-- e.g., when planned to be removed in version = '0.12' (soft-deprecated since 0.10-dev),
|
||||
-- show warnings since 0.11, including 0.11-dev (hard_deprecated_since = 0.11-dev).
|
||||
-- Example: if removal_version is 0.12 (soft-deprecated since 0.10-dev), show warnings starting at
|
||||
-- 0.11, including 0.11-dev (hard_deprecated_since = 0.11-dev).
|
||||
if plugin == 'Nvim' then
|
||||
local current_version = vim.version() ---@type vim.Version
|
||||
local removal_version = assert(vim.version.parse(version))
|
||||
@ -1075,14 +1076,17 @@ function vim.deprecate(name, alternative, version, plugin, backtrace)
|
||||
|
||||
if not is_hard_deprecated then
|
||||
return
|
||||
elseif current_version >= removal_version then
|
||||
will_be_removed = 'was removed'
|
||||
end
|
||||
end
|
||||
|
||||
local msg = ('%s is deprecated'):format(name)
|
||||
msg = alternative and ('%s, use %s instead.'):format(msg, alternative) or (msg .. '.')
|
||||
msg = ('%s%s\nThis feature will be removed in %s version %s'):format(
|
||||
msg = ('%s%s\nFeature %s in %s %s'):format(
|
||||
msg,
|
||||
(plugin == 'Nvim' and ' :help deprecated' or ''),
|
||||
will_be_removed,
|
||||
plugin,
|
||||
version
|
||||
)
|
||||
|
Reference in New Issue
Block a user