Skip to content
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

Move to non deprecated function calls #1930

Merged
merged 2 commits into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lua/cmp/utils/misc.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local misc = {}

local islist = vim.islist or vim.tbl_islist

---Create once callback
---@param callback function
---@return function
Expand Down Expand Up @@ -88,8 +90,8 @@ misc.none = vim.NIL
---@param tbl2 T
---@return T
misc.merge = function(tbl1, tbl2)
local is_dict1 = type(tbl1) == 'table' and (not vim.tbl_islist(tbl1) or vim.tbl_isempty(tbl1))
local is_dict2 = type(tbl2) == 'table' and (not vim.tbl_islist(tbl2) or vim.tbl_isempty(tbl2))
local is_dict1 = type(tbl1) == 'table' and (not islist(tbl1) or vim.tbl_isempty(tbl1))
local is_dict2 = type(tbl2) == 'table' and (not islist(tbl2) or vim.tbl_isempty(tbl2))
if is_dict1 and is_dict2 then
local new_tbl = {}
for k, v in pairs(tbl2) do
Expand Down Expand Up @@ -163,7 +165,7 @@ misc.copy = function(tbl)
return tbl
end

if vim.tbl_islist(tbl) then
if islist(tbl) then
local copy = {}
for i, value in ipairs(tbl) do
copy[i] = misc.copy(value)
Expand Down