diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-11-02 08:50:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-02 08:50:44 -0500 |
| commit | dc14b1468afeb53c9ca0a734a2035cc54b5e1d94 (patch) | |
| tree | d34b8bafd49892a678c38f79039191c079bfa944 /runtime/lua/vim/lsp/rpc.lua | |
| parent | 6224ec3d4a672a9beb7522a34e61fa3b335bf070 (diff) | |
| download | rneovim-dc14b1468afeb53c9ca0a734a2035cc54b5e1d94.tar.gz rneovim-dc14b1468afeb53c9ca0a734a2035cc54b5e1d94.tar.bz2 rneovim-dc14b1468afeb53c9ca0a734a2035cc54b5e1d94.zip | |
lsp: remove vim.NIL from processing (#13174)
* lsp: remove vim.NIL from processing
* lsp: remove instances of vim.NIL
Diffstat (limited to 'runtime/lua/vim/lsp/rpc.lua')
| -rw-r--r-- | runtime/lua/vim/lsp/rpc.lua | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 749a51fecc..17c411f952 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -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 |