summaryrefslogtreecommitdiff
path: root/script/core/linker.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-13 21:31:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-13 21:31:02 +0800
commitd6966ae7915b4c5446c48c7a88793617502fd6c6 (patch)
tree7c44aed3ecf3418388fc5a1a9d9f14789b1ae81d /script/core/linker.lua
parent50832a63579ba96587a8bd9bcf408302cea808e0 (diff)
downloadlua-language-server-d6966ae7915b4c5446c48c7a88793617502fd6c6.zip
stash
Diffstat (limited to 'script/core/linker.lua')
-rw-r--r--script/core/linker.lua24
1 files changed, 21 insertions, 3 deletions
diff --git a/script/core/linker.lua b/script/core/linker.lua
index e57cbaa0..079c2aa4 100644
--- a/script/core/linker.lua
+++ b/script/core/linker.lua
@@ -8,7 +8,8 @@ local SPLIT_CHAR = '\x1F'
local LAST_REGEX = SPLIT_CHAR .. '[^' .. SPLIT_CHAR .. ']*$'
local FIRST_REGEX = '^[^' .. SPLIT_CHAR .. ']*'
local RETURN_INDEX_CHAR = '#'
-local PARAM_INDEX_CHAR = '@'
+local PARAM_INDEX_CHAR = '@'
+local TABLE_KEY_CHAR = '<'
---创建source的链接信息
---@param id string
@@ -337,9 +338,10 @@ end
local m = {}
-m.SPLIT_CHAR = SPLIT_CHAR
+m.SPLIT_CHAR = SPLIT_CHAR
m.RETURN_INDEX_CHAR = RETURN_INDEX_CHAR
-m.PARAM_INDEX_CHAR = PARAM_INDEX_CHAR
+m.PARAM_INDEX_CHAR = PARAM_INDEX_CHAR
+m.TABLE_KEY_CHAR = TABLE_KEY_CHAR
---添加关联单元
---@param source parser.guide.object
@@ -539,6 +541,14 @@ function m.compileLink(source)
end
end
if source.type == 'doc.type.table' then
+ if source.tkey then
+ local keyID = ('%s%s%s'):format(
+ id,
+ SPLIT_CHAR,
+ TABLE_KEY_CHAR
+ )
+ pushForward(keyID, getID(source.tkey))
+ end
if source.tvalue then
local valueID = ('%s%s'):format(
id,
@@ -664,6 +674,14 @@ function m.compileLink(source)
pushForward(nodeID, getID(source.node))
end
if proto.type == 'doc.type.table' then
+ if source.tkey then
+ local keyID = ('%s%s%s'):format(
+ id,
+ SPLIT_CHAR,
+ TABLE_KEY_CHAR
+ )
+ pushForward(keyID, getID(source.tkey))
+ end
if source.tvalue then
local valueID = ('%s%s'):format(
id,