aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_editor.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-10-20 16:44:39 -0700
committerGitHub <noreply@github.com>2024-10-20 16:44:39 -0700
commit86832dcd1922eee37acc26310f72aa70def1514b (patch)
treed9db0de1011d6b495e62e7a2a90d46de97f06996 /runtime/lua/vim/_editor.lua
parent8c2d45be77299d6eb70165697bc5c29898cdb25e (diff)
parent18b43c331d8a0ed87d7cbefe2a18543b8e4ad360 (diff)
downloadrneovim-86832dcd1922eee37acc26310f72aa70def1514b.tar.gz
rneovim-86832dcd1922eee37acc26310f72aa70def1514b.tar.bz2
rneovim-86832dcd1922eee37acc26310f72aa70def1514b.zip
Merge #30840 from justinmk/renamehl
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r--runtime/lua/vim/_editor.lua23
1 files changed, 16 insertions, 7 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index f0b8cf6a52..7aba7498f9 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -32,7 +32,7 @@ for k, v in pairs({
func = true,
F = true,
lsp = true,
- highlight = true,
+ hl = true,
diagnostic = true,
keymap = true,
ui = true,
@@ -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
@@ -1191,4 +1197,7 @@ require('vim._options')
---@deprecated
vim.loop = vim.uv
+-- Deprecated. Remove at Nvim 2.0
+vim.highlight = vim._defer_deprecated_module('vim.highlight', 'vim.hl')
+
return vim