mirror of
https://github.com/neovim/neovim.git
synced 2025-11-16 07:11:20 +00:00
lsp: remove vim.NIL from processing (#13174)
* lsp: remove vim.NIL from processing * lsp: remove instances of vim.NIL
This commit is contained in:
@@ -42,13 +42,28 @@ local function is_dir(filename)
|
||||
end
|
||||
|
||||
local NIL = vim.NIL
|
||||
|
||||
--@private
|
||||
local recursive_convert_NIL
|
||||
recursive_convert_NIL = function(v, tbl_processed)
|
||||
if v == NIL then
|
||||
return nil
|
||||
elseif not tbl_processed[v] and type(v) == 'table' then
|
||||
tbl_processed[v] = true
|
||||
return vim.tbl_map(function(x)
|
||||
return recursive_convert_NIL(x, tbl_processed)
|
||||
end, v)
|
||||
end
|
||||
|
||||
return v
|
||||
end
|
||||
|
||||
--@private
|
||||
--- Returns its argument, but converts `vim.NIL` to Lua `nil`.
|
||||
--@param v (any) Argument
|
||||
--@returns (any)
|
||||
local function convert_NIL(v)
|
||||
if v == NIL then return nil end
|
||||
return v
|
||||
return recursive_convert_NIL(v, {})
|
||||
end
|
||||
|
||||
--@private
|
||||
|
||||
Reference in New Issue
Block a user