summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-21 21:46:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-21 21:46:55 +0800
commitb0c3c3047361c63c7f0c0587ec98964c6a7c4a98 (patch)
tree0e56b53e1732d444d19ecbcac27403511373914e /script
parent7a9530ffc1e9b79ba1fc54653435952b21e34d05 (diff)
downloadlua-language-server-b0c3c3047361c63c7f0c0587ec98964c6a7c4a98.zip
cleanup
Diffstat (limited to 'script')
-rw-r--r--script/core/linker.lua6
-rw-r--r--script/core/searcher.lua2
2 files changed, 5 insertions, 3 deletions
diff --git a/script/core/linker.lua b/script/core/linker.lua
index bb81709d..3185ecda 100644
--- a/script/core/linker.lua
+++ b/script/core/linker.lua
@@ -6,6 +6,7 @@ local Linkers
local LastIDCache = {}
local SPLIT_CHAR = '\x1F'
local SPLIT_REGEX = SPLIT_CHAR .. '.-$'
+local INDEX_CHAR = '\x1E'
---是否是全局变量(包括 _G.XXX 形式)
---@param source parser.guide.object
@@ -84,7 +85,7 @@ local function getKey(source)
elseif source.type == 'function' then
return source.start, nil
elseif source.type == 'select' then
- return ('%d%s%d'):format(source.start, SPLIT_CHAR, source.index)
+ return ('%d%s%s%d'):format(source.start, SPLIT_CHAR, INDEX_CHAR, source.index)
elseif source.type == 'doc.class.name'
or source.type == 'doc.type.name'
or source.type == 'doc.alias.name' then
@@ -265,7 +266,7 @@ local function checkBackward(source, id)
if source.returnIndex then
for _, src in ipairs(parent.bindSources) do
if src.type == 'function' then
- local fullID = ('%s%s%s'):format(getID(src), SPLIT_CHAR, source.returnIndex)
+ local fullID = ('%s%s%s%s'):format(getID(src), SPLIT_CHAR, INDEX_CHAR, source.returnIndex)
list[#list+1] = fullID
end
end
@@ -324,6 +325,7 @@ end
local m = {}
m.SPLIT_CHAR = SPLIT_CHAR
+m.INDEX_CHAR = INDEX_CHAR
---根据ID来获取所有的link
---@param root parser.guide.object
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 069def94..c3d61199 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -166,7 +166,7 @@ function m.searchRefsByID(status, uri, expect, mode)
if not parentID then
return
end
- search(parentID, linker.SPLIT_CHAR .. returnIndex)
+ search(parentID, linker.SPLIT_CHAR .. linker.INDEX_CHAR .. returnIndex)
end
local function checkForward(link, field)