fix lsp_code_action error when no code action available (#243)

the results variable can be nil when there's no code action available,

check for nil results before checking the length
This commit is contained in:
YIQUN
2020-11-15 21:41:58 +08:00
committed by GitHub
parent 3c4a88efe4
commit 0ccd69f5a9

View File

@@ -229,7 +229,7 @@ builtin.lsp_code_actions = function(opts)
local results = (results_lsp[1] or results_lsp[2]).result;
if #results == 0 then
if not results or #results == 0 then
print("No code actions available")
return
end