Skip to content

Conversation

@Chamal1120
Copy link
Contributor

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).

- 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.
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
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

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.

@Chamal1120 Chamal1120 force-pushed the nvim-0.11-deprecated-fixes branch from 2a1c343 to 99f643b Compare April 27, 2025 14:51
@glepnir glepnir merged commit 0e9f996 into nvimdev:master Apr 28, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants