summaryrefslogtreecommitdiff
path: root/script/core/code-action.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 02:57:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 02:57:13 +0800
commit838ce36fdd7abdff0b4cab5e67c2500325178805 (patch)
treebffd74f604cbcf666ca5d41d1c9f5750e48e1db9 /script/core/code-action.lua
parent0ff98557a45c25d7a49520e57f49561a62300f35 (diff)
downloadlua-language-server-838ce36fdd7abdff0b4cab5e67c2500325178805.zip
update
Diffstat (limited to 'script/core/code-action.lua')
-rw-r--r--script/core/code-action.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua
index f9926b64..4eb21ff8 100644
--- a/script/core/code-action.lua
+++ b/script/core/code-action.lua
@@ -451,7 +451,7 @@ end
local function checkSwapParams(results, uri, start, finish)
local state = files.getState(uri)
local text = files.getText(uri)
- if not state then
+ if not state or not text then
return
end
local args = {}
@@ -619,6 +619,9 @@ end
local function checkJsonToLua(results, uri, start, finish)
local text = files.getText(uri)
local state = files.getState(uri)
+ if not state or not text then
+ return
+ end
local startOffset = guide.positionToOffset(state, start)
local finishOffset = guide.positionToOffset(state, finish)
local jsonStart = text:match('()[%{%[]', startOffset + 1)