summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-14 20:43:33 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-14 20:43:33 +0800
commit5a072004414ff1f8de416c62a4067774f72e7097 (patch)
tree098b490fadec58205a1c8f944ec590c957e86a1c /script/core
parent4d1b606cc875803cc07031c63cde351300ea664a (diff)
downloadlua-language-server-5a072004414ff1f8de416c62a4067774f72e7097.zip
cleanup
Diffstat (limited to 'script/core')
-rw-r--r--script/core/code-action.lua2
-rw-r--r--script/core/completion.lua2
-rw-r--r--script/core/diagnostics/newfield-call.lua4
-rw-r--r--script/core/diagnostics/newline-call.lua4
-rw-r--r--script/core/find-source.lua6
-rw-r--r--script/core/keyword.lua4
-rw-r--r--script/core/reference.lua4
-rw-r--r--script/core/type-formatting.lua2
8 files changed, 14 insertions, 14 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua
index 64f862f9..1bac9359 100644
--- a/script/core/code-action.lua
+++ b/script/core/code-action.lua
@@ -57,7 +57,7 @@ end
local function disableDiagnostic(uri, code, start, results)
local lines = files.getLines(uri)
- local row = guide.positionOf(lines, start)
+ local row = guide.positionOf(start)
results[#results+1] = {
title = lang.script('ACTION_DISABLE_DIAG', code),
kind = 'quickfix',
diff --git a/script/core/completion.lua b/script/core/completion.lua
index f81f8179..59dc19f3 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -176,7 +176,7 @@ local function getSnip(source)
if vm.isMetaFile(uri) then
goto CONTINUE
end
- local row = guide.positionOf(lines, def.start)
+ local row = guide.positionOf(def.start)
local firstRow = lines[row]
local lastRow = lines[math.min(row + context - 1, #lines)]
local snip = text:sub(firstRow.start, lastRow.finish)
diff --git a/script/core/diagnostics/newfield-call.lua b/script/core/diagnostics/newfield-call.lua
index fe86ad66..61d52dd2 100644
--- a/script/core/diagnostics/newfield-call.lua
+++ b/script/core/diagnostics/newfield-call.lua
@@ -27,8 +27,8 @@ return function (uri, callback)
local func = call.node
local args = call.args
if args then
- local funcLine = guide.positionOf(lines, func.finish)
- local argsLine = guide.positionOf(lines, args.start)
+ local funcLine = guide.positionOf(func.finish)
+ local argsLine = guide.positionOf(args.start)
if argsLine > funcLine then
callback {
start = call.start,
diff --git a/script/core/diagnostics/newline-call.lua b/script/core/diagnostics/newline-call.lua
index 71dc33e2..69bf948f 100644
--- a/script/core/diagnostics/newline-call.lua
+++ b/script/core/diagnostics/newline-call.lua
@@ -26,8 +26,8 @@ return function (uri, callback)
return
end
- local nodeRow = guide.positionOf(lines, node.finish)
- local argRow = guide.positionOf(lines, args.start)
+ local nodeRow = guide.positionOf(node.finish)
+ local argRow = guide.positionOf(args.start)
if nodeRow == argRow then
return
end
diff --git a/script/core/find-source.lua b/script/core/find-source.lua
index edbb1e2c..26a411e5 100644
--- a/script/core/find-source.lua
+++ b/script/core/find-source.lua
@@ -11,12 +11,12 @@ local function isValidFunctionPos(source, offset)
return false
end
-return function (ast, offset, accept)
+return function (ast, position, accept)
local len = math.huge
local result
- guide.eachSourceContain(ast.ast, offset, function (source)
+ guide.eachSourceContain(ast.ast, position, function (source)
if source.type == 'function' then
- if not isValidFunctionPos(source, offset) then
+ if not isValidFunctionPos(source, position) then
return
end
end
diff --git a/script/core/keyword.lua b/script/core/keyword.lua
index b8e37605..4b43efe5 100644
--- a/script/core/keyword.lua
+++ b/script/core/keyword.lua
@@ -275,8 +275,8 @@ until $1"
if first == 'end'
or first == 'else'
or first == 'elseif' then
- local startRow = guide.positionOf(lines, info.start)
- local finishRow = guide.positionOf(lines, pos)
+ local startRow = guide.positionOf(info.start)
+ local finishRow = guide.positionOf(pos)
local startSp = info.text:match('^%s*', lines[startRow].start + 1)
local finishSp = info.text:match('^%s*', lines[finishRow].start + 1)
if startSp == finishSp then
diff --git a/script/core/reference.lua b/script/core/reference.lua
index 5f5831c6..067d2e23 100644
--- a/script/core/reference.lua
+++ b/script/core/reference.lua
@@ -52,13 +52,13 @@ local accept = {
['doc.alias.name'] = true,
}
-return function (uri, offset)
+return function (uri, position)
local ast = files.getState(uri)
if not ast then
return nil
end
- local source = findSource(ast, offset, accept)
+ local source = findSource(ast, position, accept)
if not source then
return nil
end
diff --git a/script/core/type-formatting.lua b/script/core/type-formatting.lua
index a225d9d7..12272f11 100644
--- a/script/core/type-formatting.lua
+++ b/script/core/type-formatting.lua
@@ -5,7 +5,7 @@ local guide = require "parser.guide"
local function insertIndentation(uri, offset, edits)
local lines = files.getLines(uri)
local text = files.getOriginText(uri)
- local row = guide.positionOf(lines, offset)
+ local row = guide.positionOf(offset)
local line = lines[row]
local indent = text:sub(line.start, line.finish):match '^%s*'
for _, edit in ipairs(edits) do