diff options
| author | Michiel van den Heuvel <michielvdnheuvel@gmail.com> | 2025-05-12 12:32:23 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-05-14 21:29:36 -0600 |
| commit | 24b0fbed65cd0fb891b4c660716e7dca118cf935 (patch) | |
| tree | 3c079b0f0e41042034601e6a1b56a608042faa62 /init.lua | |
| parent | 133b1aab256ad7ba7a580723abc68ea896c220b5 (diff) | |
| download | vis-lspc-24b0fbed65cd0fb891b4c660716e7dca118cf935.tar.gz vis-lspc-24b0fbed65cd0fb891b4c660716e7dca118cf935.zip | |
Check lsp return value is table in handlers
At least in lua-cjson, null is sometimes returned as a (light) userdata
value. This resulted in ugly errors.
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -725,7 +725,7 @@ function LanguageServer:call_text_document_method(method, params, win, ctx) end local function lspc_handle_goto_method_response(req, result) - if not result or next(result) == nil then + if not result or type(result) ~= 'table' or next(result) == nil then lspc:warn(req.method .. ' found no results') return end @@ -772,7 +772,7 @@ local function lspc_handle_goto_method_response(req, result) end local function lspc_handle_completion_method_response(win, result, old_pos) - if not result or not result.items then + if not result or type(result) ~= 'table' or not result.items then lspc:warn('no completion available') return end @@ -860,7 +860,7 @@ local function lspc_handle_completion_method_response(win, result, old_pos) end local function lspc_handle_hover_method_response(win, result, old_pos) - if not result or not result.contents then + if not result or type(result) ~= 'table' or not result.contents then lspc:warn('no hover available') return end @@ -894,7 +894,7 @@ local function lspc_handle_hover_method_response(win, result, old_pos) end local function lspc_handle_signature_help_method_response(win, result, call_pos) - if not result or not result.signatures or #result.signatures == 0 then + if not result or type(result) ~= 'table' or not result.signatures or #result.signatures == 0 then lspc:warn('no signature help available') return end |
