From 986bed23294d000565ceb04274a6c645b7c987c9 Mon Sep 17 00:00:00 2001 From: Andy Lindeman Date: Fri, 15 May 2020 21:34:28 -0400 Subject: Check for nil before checking for empty table At least the `gopls` language server seems to return nil/null if no code actions are available. Currently this results in an error: > Error executing vim.schedule lua callback: shared.lua:199: Expected table, got nil --- runtime/lua/vim/lsp/callbacks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/callbacks.lua') diff --git a/runtime/lua/vim/lsp/callbacks.lua b/runtime/lua/vim/lsp/callbacks.lua index 17f88a5181..37e9f1e5c1 100644 --- a/runtime/lua/vim/lsp/callbacks.lua +++ b/runtime/lua/vim/lsp/callbacks.lua @@ -19,7 +19,7 @@ M['workspace/executeCommand'] = function(err, _) end M['textDocument/codeAction'] = function(_, _, actions) - if vim.tbl_isempty(actions) then + if actions == nil or vim.tbl_isempty(actions) then print("No code actions available") return end -- cgit