summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/definition.lua30
-rw-r--r--server/src/core/document_symbol.lua11
-rw-r--r--server/src/core/hover/name.lua6
-rw-r--r--server/src/core/implementation.lua36
-rw-r--r--server/src/core/references.lua12
-rw-r--r--server/src/core/rename.lua8
6 files changed, 50 insertions, 53 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua
index 1ae6b97e..b7aadb44 100644
--- a/server/src/core/definition.lua
+++ b/server/src/core/definition.lua
@@ -30,11 +30,11 @@ end
local function parseValueCrossFile(vm, source, lsp)
local value = source:bindValue()
local positions = {}
- value:eachInfo(function (info)
- if info.type == 'local' and info.source.uri == value.uri then
+ value:eachInfo(function (info, src)
+ if info.type == 'local' and src.uri == value.uri then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
value.uri,
}
return true
@@ -44,11 +44,11 @@ local function parseValueCrossFile(vm, source, lsp)
return positions
end
- value:eachInfo(function (info)
- if info.type == 'set' and info.source.uri == value.uri then
+ value:eachInfo(function (info, src)
+ if info.type == 'set' and src.uri == value.uri then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
value.uri,
}
end
@@ -57,11 +57,11 @@ local function parseValueCrossFile(vm, source, lsp)
return positions
end
- value:eachInfo(function (info)
- if info.type == 'return' and info.source.uri == value.uri then
+ value:eachInfo(function (info, src)
+ if info.type == 'return' and src.uri == value.uri then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
value.uri,
}
end
@@ -115,11 +115,11 @@ local function parseValue(vm, source, lsp)
return parseValueCrossFile(vm, source, lsp)
end
local positions = {}
- value:eachInfo(function (info)
+ value:eachInfo(function (info, src)
if info.type == 'set' then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
}
end
end)
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua
index 2b1ecfbf..8225fdb9 100644
--- a/server/src/core/document_symbol.lua
+++ b/server/src/core/document_symbol.lua
@@ -35,18 +35,15 @@ local function isFirstSet(source, value)
if source:action() ~= 'set' then
return false
end
- local firstSet = value:eachInfo(function (info)
+ local firstSrc = value:eachInfo(function (info, src)
if info.type == 'set' then
- return info
+ return src
end
end)
- if not firstSet then
+ if not firstSrc then
return false
end
- if firstSet.type ~= 'set' then
- return false
- end
- if firstSet.source ~= source then
+ if firstSrc ~= source then
return false
end
return true
diff --git a/server/src/core/hover/name.lua b/server/src/core/hover/name.lua
index bd35f946..b363f653 100644
--- a/server/src/core/hover/name.lua
+++ b/server/src/core/hover/name.lua
@@ -12,10 +12,10 @@ return function (source)
end
if not declarat then
-- 如果声明者没有给名字,则找一个合适的名字
- local name = value:eachInfo(function (info)
+ local name = value:eachInfo(function (info, src)
if info.type == 'local' or info.type == 'set' or info.type == 'return' then
- if info.source.type == 'name' and info.source.uri == value.uri then
- return info.source[1]
+ if src.type == 'name' and src.uri == value.uri then
+ return src[1]
end
end
end)
diff --git a/server/src/core/implementation.lua b/server/src/core/implementation.lua
index b7ca2c6e..5385d9f9 100644
--- a/server/src/core/implementation.lua
+++ b/server/src/core/implementation.lua
@@ -30,11 +30,11 @@ end
local function parseValueCrossFile(vm, source, lsp)
local value = source:bindValue()
local positions = {}
- value:eachInfo(function (info)
- if info.type == 'local' and info.source.uri == value.uri then
+ value:eachInfo(function (info, src)
+ if info.type == 'local' and src.uri == value.uri then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
value.uri,
}
return true
@@ -44,11 +44,11 @@ local function parseValueCrossFile(vm, source, lsp)
return positions
end
- value:eachInfo(function (info)
- if info.type == 'set' and info.source.uri == value.uri then
+ value:eachInfo(function (info, src)
+ if info.type == 'set' and src.uri == value.uri then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
value.uri,
}
end
@@ -57,11 +57,11 @@ local function parseValueCrossFile(vm, source, lsp)
return positions
end
- value:eachInfo(function (info)
- if info.type == 'return' and info.source.uri == value.uri then
+ value:eachInfo(function (info, src)
+ if info.type == 'return' and src.uri == value.uri then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
value.uri,
}
end
@@ -98,11 +98,11 @@ local function parseValue(vm, source, lsp)
return parseValueCrossFile(vm, source, lsp)
end
local positions = {}
- value:eachInfo(function (info)
+ value:eachInfo(function (info, src)
if info.type == 'set' then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
}
end
end)
@@ -114,11 +114,11 @@ end
local function parseLabel(vm, label, lsp)
local positions = {}
- label:eachInfo(function (info)
+ label:eachInfo(function (info, src)
if info.type == 'set' then
positions[#positions+1] = {
- info.source.start,
- info.source.finish,
+ src.start,
+ src.finish,
}
end
end)
diff --git a/server/src/core/references.lua b/server/src/core/references.lua
index 2cc14abb..0f9c73ab 100644
--- a/server/src/core/references.lua
+++ b/server/src/core/references.lua
@@ -16,24 +16,24 @@ local function parseResult(vm, source, declarat, callback)
callback(info.source)
end
end)
- loc:getValue():eachInfo(function (info)
+ loc:getValue():eachInfo(function (info, src)
if declarat or info.type == 'get' then
- callback(info.source)
+ callback(src)
end
end)
return
end
if source:bindValue() then
- source:bindValue():eachInfo(function (info)
+ source:bindValue():eachInfo(function (info, src)
if declarat or info.type == 'get' then
- callback(info.source)
+ callback(src)
end
end)
local parent = source:get 'parent'
- parent:eachInfo(function (info)
+ parent:eachInfo(function (info, src)
if info[1] == source[1] then
if (declarat and info.type == 'set child') or info.type == 'get child' then
- callback(info.source)
+ callback(src)
end
end
end)
diff --git a/server/src/core/rename.lua b/server/src/core/rename.lua
index 349ec96b..4e8e574b 100644
--- a/server/src/core/rename.lua
+++ b/server/src/core/rename.lua
@@ -47,12 +47,12 @@ local function parseResult(source, newName)
end
local parent = source:get 'parent'
local mark = {}
- parent:eachInfo(function (info)
- if not mark[info.source] then
- mark[info.source] = info
+ parent:eachInfo(function (info, src)
+ if not mark[src] then
+ mark[src] = info
if info.type == 'get child' or info.type == 'set child' then
if info[1] == source[1] then
- positions[#positions+1] = {info.source.start, info.source.finish}
+ positions[#positions+1] = {src.start, src.finish}
end
end
end