diff options
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 0bb1becf58..dda89e2bdb 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -1019,6 +1019,18 @@ end --- ---@return string|nil # Deprecated message, or nil if no message was shown. function vim.deprecate(name, alternative, version, plugin, backtrace) + -- Only issue warning if feature is hard-deprecated as specified by MAINTAIN.md. + if plugin == nil then + local current_version = vim.version() + local deprecated_version = assert(vim.version.parse(version)) + local soft_deprecated_version = + { deprecated_version.major, deprecated_version.minor - 1, deprecated_version.patch } + local deprecate = vim.version.lt(current_version, soft_deprecated_version) + if deprecate then + return + end + end + local msg = ('%s is deprecated'):format(name) plugin = plugin or 'Nvim' msg = alternative and ('%s, use %s instead.'):format(msg, alternative) or msg |