diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-04-18 07:57:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 07:57:58 -0700 |
commit | f1dfe32bf5552197e0068298b0527526a4f918b1 (patch) | |
tree | af5b20cf246d1025434f8ca9e01f2ce79d2b8847 /runtime/lua/vim/_editor.lua | |
parent | 97323d821be97deeb1a5797b4ca534156b9e9b0c (diff) | |
download | rneovim-f1dfe32bf5552197e0068298b0527526a4f918b1.tar.gz rneovim-f1dfe32bf5552197e0068298b0527526a4f918b1.tar.bz2 rneovim-f1dfe32bf5552197e0068298b0527526a4f918b1.zip |
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.
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index a40b298a37..2f6057c1f8 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -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 ) |