-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
fix: replace deprecated table methods for neovim v0.10 #1690
Conversation
FYI @skoch13 sindrets/diffview.nvim#489 (comment) I also do not see the error on the latest version of nvim nightly. I made a change to sindrets/diffview.nvim#489 to add the depth of |
@mikesmithgh thank you, I did mention that in the issue here #1689 (comment) I'll update the PR accordingly, thank you |
---@return function | ||
function M.islist() | ||
return vim.fn.has "nvim-0.10" == 1 and vim.islist or vim.tbl_islist ---@diagnostic disable-line: deprecated | ||
end |
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.
I'm also deprecating these functions in my code and using this as a reference. am I missing something here? or should this be:
---@return function | |
function M.islist() | |
return vim.fn.has "nvim-0.10" == 1 and vim.islist or vim.tbl_islist ---@diagnostic disable-line: deprecated | |
end | |
---@param t? table | |
---@return boolean `true` if list-like table, else `false`. | |
function M.islist(t) | |
return (vim.fn.has("nvim-0.10") == 1 and vim.islist or vim.tbl_islist)(t) ---@diagnostic disable-line: deprecated | |
end |
or maybe just:
---@return function | |
function M.islist() | |
return vim.fn.has "nvim-0.10" == 1 and vim.islist or vim.tbl_islist ---@diagnostic disable-line: deprecated | |
end | |
M.islist = vim.fn.has("nvim-0.10") == 1 and vim.islist or vim.tbl_islist ---@diagnostic disable-line: deprecated |
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.
Thanks for the PR! It seems like Neovim nightly temporarily broke due to the introduction of some calls that are not allowed in :h vim.in_fast_event()
(in which Mason executes quite a lot of code). It seems like that issue was fixed in the next nightly release.
There are some issues with these changes currently - current usage of flatten expects support for keyed tables, the islist()
function seems to return the function it's meant to call, and the introduction of functions in the utils.lua
is a bit misplaced (this is a util module local to the mason-core.installer.registry
module).
Thanks for brining it to my attention, I'll close this PR and open another one to replace these usages!
Credits go to sindrets/diffview.nvim#489
Fixes #1689