diff options
Diffstat (limited to 'script/core/command')
-rw-r--r-- | script/core/command/jsonToLua.lua | 4 | ||||
-rw-r--r-- | script/core/command/removeSpace.lua | 2 | ||||
-rw-r--r-- | script/core/command/solve.lua | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/script/core/command/jsonToLua.lua b/script/core/command/jsonToLua.lua index 8d9e8ba1..da1aeb4b 100644 --- a/script/core/command/jsonToLua.lua +++ b/script/core/command/jsonToLua.lua @@ -11,7 +11,7 @@ local guide = require 'parser.guide' return function (data) local state = files.getState(data.uri) local text = files.getText(data.uri) - if not text then + if not text or not state then return end local start = guide.positionToOffset(state, data.start) @@ -43,7 +43,7 @@ return function (data) changes = { [data.uri] = { { - range = converter.packRange(data.uri, data.start, data.finish), + range = converter.packRange(state, data.start, data.finish), newText = luaStr, } } diff --git a/script/core/command/removeSpace.lua b/script/core/command/removeSpace.lua index 992a0705..87d11fff 100644 --- a/script/core/command/removeSpace.lua +++ b/script/core/command/removeSpace.lua @@ -38,7 +38,7 @@ return function (data) end local firstPos = guide.offsetToPosition(state, firstOffset) - 1 textEdit[#textEdit+1] = { - range = converter.packRange(uri, firstPos, lastPos), + range = converter.packRange(state, firstPos, lastPos), newText = '', } diff --git a/script/core/command/solve.lua b/script/core/command/solve.lua index 98ceaa58..ca1458aa 100644 --- a/script/core/command/solve.lua +++ b/script/core/command/solve.lua @@ -36,7 +36,7 @@ return function (data) return end - local start, finish = converter.unpackRange(uri, data.range) + local start, finish = converter.unpackRange(state, data.range) local result = guide.eachSourceContain(state.ast, start, function (source) if source.start ~= start @@ -86,7 +86,7 @@ return function (data) changes = { [uri] = { { - range = converter.packRange(uri, result.start, result.finish), + range = converter.packRange(state, result.start, result.finish), newText = ('(%s)'):format(text:sub( guide.positionToOffset(state, result.start + 1), guide.positionToOffset(state, result.finish) |