diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-10-17 17:58:13 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-10-21 00:54:42 +0200 |
commit | 960fdc775a88389d8b19389b8c74c98921b9acac (patch) | |
tree | 8ab3f98ac1b2e7d1cfa84e451b241a256f0aea98 /runtime/lua/vim/_editor.lua | |
parent | c9c17fda80d843158d2785b047fca3a6dd78ea2f (diff) | |
download | rneovim-960fdc775a88389d8b19389b8c74c98921b9acac.tar.gz rneovim-960fdc775a88389d8b19389b8c74c98921b9acac.tar.bz2 rneovim-960fdc775a88389d8b19389b8c74c98921b9acac.zip |
fix(lua): vim.deprecate does not support major>0
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index f0b8cf6a52..037cef9383 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -1149,16 +1149,22 @@ function vim.deprecate(name, alternative, version, plugin, backtrace) if plugin == 'Nvim' then require('vim.deprecated.health').add(name, version, traceback(), alternative) - -- Only issue warning if feature is hard-deprecated as specified by MAINTAIN.md. - -- Example: if removal_version is 0.12 (soft-deprecated since 0.10-dev), show warnings starting at - -- 0.11, including 0.11-dev + -- Show a warning only if feature is hard-deprecated (see MAINTAIN.md). + -- Example: if removal `version` is 0.12 (soft-deprecated since 0.10-dev), show warnings + -- starting at 0.11, including 0.11-dev. local major, minor = version:match('(%d+)%.(%d+)') major, minor = tonumber(major), tonumber(minor) + local nvim_major = 0 --- Current Nvim major version. + + -- We can't "subtract" from a major version, so: + -- * Always treat `major > nvim_major` as soft-deprecation. + -- * Compare `minor - 1` if `major == nvim_major`. + if major > nvim_major then + return -- Always soft-deprecation (see MAINTAIN.md). + end local hard_deprecated_since = string.format('nvim-%d.%d', major, minor - 1) - -- Assume there will be no next minor version before bumping up the major version - local is_hard_deprecated = minor == 0 or vim.fn.has(hard_deprecated_since) == 1 - if not is_hard_deprecated then + if major == nvim_major and vim.fn.has(hard_deprecated_since) == 0 then return end |