diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-08 16:18:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-08 16:18:48 +0800 |
commit | 7eba9a99df2f54f2d767d969b53b2c1f03a95caa (patch) | |
tree | e45aae42c1238075cc01337d0b124f60fb1edfce | |
parent | a30de10b76398e6e0bacd06acca32915e1447cae (diff) | |
download | lua-language-server-7eba9a99df2f54f2d767d969b53b2c1f03a95caa.zip |
pass tests
-rw-r--r-- | script/core/code-action.lua | 15 | ||||
-rw-r--r-- | script/core/signature.lua | 3 | ||||
-rw-r--r-- | script/core/type-formatting.lua | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua index 1ec2aa8b..9ed000e9 100644 --- a/script/core/code-action.lua +++ b/script/core/code-action.lua @@ -1,10 +1,9 @@ local files = require 'files' local lang = require 'language' -local define = require 'proto.define' -local searcher = require 'core.searcher' local util = require 'utility' local sp = require 'bee.subprocess' local vm = require 'vm' +local guide = require "parser.guide" local function checkDisableByLuaDocExits(uri, row, mode, code) local lines = files.getLines(uri) @@ -59,7 +58,7 @@ end local function disableDiagnostic(uri, code, start, results) local lines = files.getLines(uri) - local row = searcher.positionOf(lines, start) + local row = guide.positionOf(lines, start) results[#results+1] = { title = lang.script('ACTION_DISABLE_DIAG', code), kind = 'quickfix', @@ -137,12 +136,12 @@ end local function solveUndefinedGlobal(uri, diag, results) local ast = files.getAst(uri) local offset = files.offsetOfWord(uri, diag.range.start) - searcher.eachSourceContain(ast.ast, offset, function (source) + guide.eachSourceContain(ast.ast, offset, function (source) if source.type ~= 'getglobal' then return end - local name = searcher.getKeyName(source) + local name = guide.getKeyName(source) markGlobal(uri, name, results) end) @@ -156,12 +155,12 @@ end local function solveLowercaseGlobal(uri, diag, results) local ast = files.getAst(uri) local offset = files.offsetOfWord(uri, diag.range.start) - searcher.eachSourceContain(ast.ast, offset, function (source) + guide.eachSourceContain(ast.ast, offset, function (source) if source.type ~= 'setglobal' then return end - local name = searcher.getKeyName(source) + local name = guide.getKeyName(source) markGlobal(uri, name, results) end) end @@ -357,7 +356,7 @@ local function checkSwapParams(results, uri, start, finish) return end local args = {} - searcher.eachSourceBetween(ast.ast, start, finish, function (source) + guide.eachSourceBetween(ast.ast, start, finish, function (source) if source.type == 'callargs' or source.type == 'funcargs' then local targetIndex diff --git a/script/core/signature.lua b/script/core/signature.lua index d01557cd..915310c0 100644 --- a/script/core/signature.lua +++ b/script/core/signature.lua @@ -3,11 +3,12 @@ local searcher = require 'core.searcher' local vm = require 'vm' local hoverLabel = require 'core.hover.label' local hoverDesc = require 'core.hover.description' +local guide = require 'parser.guide' local function findNearCall(uri, ast, pos) local text = files.getText(uri) local nearCall - searcher.eachSourceContain(ast.ast, pos, function (src) + guide.eachSourceContain(ast.ast, pos, function (src) if src.type == 'call' or src.type == 'table' or src.type == 'function' then diff --git a/script/core/type-formatting.lua b/script/core/type-formatting.lua index 79dccc8f..49a721e5 100644 --- a/script/core/type-formatting.lua +++ b/script/core/type-formatting.lua @@ -1,11 +1,11 @@ local files = require 'files' local lookBackward = require 'core.look-backward' -local searcher = require 'core.searcher' +local guide = require "parser.guide" local function insertIndentation(uri, offset, edits) local lines = files.getLines(uri) local text = files.getOriginText(uri) - local row = searcher.positionOf(lines, offset) + local row = guide.positionOf(lines, offset) local line = lines[row] local indent = text:sub(line.start, line.finish):match '^%s*' for _, edit in ipairs(edits) do |