aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/callbacks.lua
diff options
context:
space:
mode:
authorAndy Lindeman <andy@lindeman.io>2020-05-15 21:34:28 -0400
committerAndy Lindeman <andy@lindeman.io>2020-05-15 21:34:28 -0400
commit986bed23294d000565ceb04274a6c645b7c987c9 (patch)
tree42a4e3859cd63da176993247978fea042142d878 /runtime/lua/vim/lsp/callbacks.lua
parentf559e5249e3aa155687b335272da8f0c73255ee4 (diff)
downloadrneovim-986bed23294d000565ceb04274a6c645b7c987c9.tar.gz
rneovim-986bed23294d000565ceb04274a6c645b7c987c9.tar.bz2
rneovim-986bed23294d000565ceb04274a6c645b7c987c9.zip
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
Diffstat (limited to 'runtime/lua/vim/lsp/callbacks.lua')
-rw-r--r--runtime/lua/vim/lsp/callbacks.lua2
1 files changed, 1 insertions, 1 deletions
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