mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
feat(vim.deprecate): only issue warning if neovim version is high enough
As specified by MAINTAIN.md, features should be soft deprecated at first (meaning no warnings) to give people a chance to adjust. The problem with this approach is that deprecating a feature becomes harder than usual as during the soft deprecation period you need to remember not to issue a warning, and during the hard deprecation period you need to remember to start issuing a warning. This behavior is only enforced if the `plugin` parameter is `nil` as plugins may not want this specific behavior.
This commit is contained in:
@@ -132,11 +132,13 @@ describe('lua stdlib', function()
|
||||
-- vim.deprecate(name, alternative, version, plugin, backtrace)
|
||||
eq(dedent[[
|
||||
foo.bar() is deprecated, use zub.wooo{ok=yay} instead. :help deprecated
|
||||
This feature will be removed in Nvim version 2.17]],
|
||||
exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '2.17'))
|
||||
This feature will be removed in Nvim version 0.10]],
|
||||
exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '0.10'))
|
||||
-- Same message, skipped.
|
||||
eq(vim.NIL,
|
||||
exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '2.17'))
|
||||
exec_lua('return vim.deprecate(...)', 'foo.bar()', 'zub.wooo{ok=yay}', '0.10'))
|
||||
-- Don't show error if not hard deprecated
|
||||
eq(vim.NIL, exec_lua('return vim.deprecate(...)', 'foo.bar()', 'nil', '5000.0.0'))
|
||||
-- When `plugin` is specified, don't show ":help deprecated". #22235
|
||||
eq(dedent[[
|
||||
foo.bar() is deprecated, use zub.wooo{ok=yay} instead.
|
||||
|
||||
Reference in New Issue
Block a user