feat(utils): Add a helper to handle vim.validate for tables#508
Merged
glepnir merged 8 commits intonvimdev:masterfrom Apr 28, 2025
Merged
feat(utils): Add a helper to handle vim.validate for tables#508glepnir merged 8 commits intonvimdev:masterfrom
glepnir merged 8 commits intonvimdev:masterfrom
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.
glepnir
reviewed
Apr 27, 2025
lua/dashboard/utils.lua
Outdated
| 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 |
Contributor
Author
There was a problem hiding this comment.
@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.
Member
There was a problem hiding this comment.
this is i used in nvim-lspcofig
Contributor
Author
There was a problem hiding this comment.
Cool, then that's confirmed to be working. I'll switch to that then.
2a1c343 to
99f643b
Compare
Co-authored-by: glepnir <glephunter@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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().minorreturns the expected output).