mirror of
https://github.com/hrsh7th/nvim-cmp
synced 2024-09-16 20:54:03 +02:00
Move to non deprecated function calls (#1930)
* Move to non deprecated function calls * Keeping it compatible with older versions
This commit is contained in:
parent
31a2939e55
commit
abacd4cb7f
1 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
|||
local misc = {}
|
||||
|
||||
local islist = vim.islist or vim.tbl_islist
|
||||
|
||||
---Create once callback
|
||||
---@param callback function
|
||||
---@return function
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue