-
-
Notifications
You must be signed in to change notification settings - Fork 199
feat(utils): Add a helper to handle vim.validate for tables #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(utils): Add a helper to handle vim.validate for tables #508
Conversation
- Replaced vim.validate() with Lua-style type checks - Future-proofed utility functions for Neovim 0.11+
Replaced custom assert() checks with official vim.validate() form 1, as recommended in Neovim 0.11+ to ensure better consistency with core APIs and forward compatibility.
lua/dashboard/utils.lua
Outdated
@@ -2,12 +2,22 @@ local uv = vim.loop | |||
local utils = {} | |||
|
|||
utils.is_win = uv.os_uname().version:match('Windows') | |||
local is_nvim_11_or_newer = vim.version().minor >= 11 -- check nvim minor ver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vim.fn.has 'nvim-0.11' == 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glepnir is it the right way to check?
If you have access to a neovim version < 0.11, can you try this in the cmdline.
:print(vim.version().minor)
if it prints anything below 11, the line i have put should work.
Will vim.fn.has 'nvim-0.11' == 1
keep working for the future as well?. Seems to me it only verifies a single version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is i used in nvim-lspcofig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, then that's confirmed to be working. I'll switch to that then.
2a1c343
to
99f643b
Compare
New helper function to handle vim.validate dynamically for tables
NOTE: I only tested this on my machine which has neovim version 0.11. But hopefully should work on older neovim versions now (as long as the
vim.version().minor
returns the expected output).