diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-23 16:02:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-23 16:02:08 +0800 |
commit | 466874e8a8e360634833a07508fb48131530b704 (patch) | |
tree | b5ea2e570b2e2621658d44891b7949bc867fa247 /script/core | |
parent | 5c9b1b467af1636ea21a9bd3d398e220790eea54 (diff) | |
download | lua-language-server-466874e8a8e360634833a07508fb48131530b704.zip |
cleanup
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/code-action.lua | 2 | ||||
-rw-r--r-- | script/core/command/jsonToLua.lua | 15 | ||||
-rw-r--r-- | script/core/command/removeSpace.lua | 11 | ||||
-rw-r--r-- | script/core/command/solve.lua | 2 | ||||
-rw-r--r-- | script/core/noder.lua | 2 |
5 files changed, 17 insertions, 15 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua index 2bc6ae50..40aef8fc 100644 --- a/script/core/code-action.lua +++ b/script/core/code-action.lua @@ -166,7 +166,7 @@ local function findSyntax(uri, diag) local ast = files.getState(uri) for _, err in ipairs(ast.errs) do if err.type:lower():gsub('_', '-') == diag.code then - local range = files.range(uri, err.start, err.finish) + local range = converter.packRange(uri, err.start, err.finish) if util.equal(range, diag.range) then return err end diff --git a/script/core/command/jsonToLua.lua b/script/core/command/jsonToLua.lua index c4f001ff..8a493b5e 100644 --- a/script/core/command/jsonToLua.lua +++ b/script/core/command/jsonToLua.lua @@ -1,9 +1,10 @@ -local files = require 'files' -local json = require 'json' -local util = require 'utility' -local proto = require 'proto' -local define = require 'proto.define' -local lang = require 'language' +local files = require 'files' +local json = require 'json' +local util = require 'utility' +local proto = require 'proto' +local define = require 'proto.define' +local lang = require 'language' +local converter = require 'proto.converter' return function (data) local text = files.getText(data.uri) @@ -26,7 +27,7 @@ return function (data) changes = { [data.uri] = { { - range = files.range(data.uri, data.start, data.finish), + range = converter.packRange(data.uri, data.start, data.finish), newText = luaStr, } } diff --git a/script/core/command/removeSpace.lua b/script/core/command/removeSpace.lua index 34c74ce0..3d7795a1 100644 --- a/script/core/command/removeSpace.lua +++ b/script/core/command/removeSpace.lua @@ -1,7 +1,8 @@ -local files = require 'files' -local guide = require 'parser.guide' -local proto = require 'proto' -local lang = require 'language' +local files = require 'files' +local guide = require 'parser.guide' +local proto = require 'proto' +local lang = require 'language' +local converter = require 'proto.converter' local function isInString(ast, offset) return guide.eachSourceContain(ast.ast, offset, function (source) @@ -30,7 +31,7 @@ return function (data) goto NEXT_LINE end textEdit[#textEdit+1] = { - range = files.range(uri, start, finish), + range = converter.packRange(uri, start, finish), newText = '', } goto NEXT_LINE diff --git a/script/core/command/solve.lua b/script/core/command/solve.lua index 790adbee..9428d065 100644 --- a/script/core/command/solve.lua +++ b/script/core/command/solve.lua @@ -85,7 +85,7 @@ return function (data) changes = { [uri] = { { - range = files.range(uri, result.start, result.finish), + range = converter.packRange(uri, result.start, result.finish), newText = ('(%s)'):format(text:sub(result.start, result.finish)), } }, diff --git a/script/core/noder.lua b/script/core/noder.lua index 1107dcda..177a151c 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1337,7 +1337,7 @@ function m.compileNode(noders, source) local id = getID(source) bindValue(noders, source, id) - if specialMap[source.special] then + if id and specialMap[source.special] then noders.skip[id] = true end |