diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-05-31 20:45:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-05-31 20:45:13 +0800 |
commit | fea133554b47ac6aef9a55d53e3f694311b10fcd (patch) | |
tree | f6a8e975cfb530de4dfe328e24b1df2a7d0eca3d /script/core/noder.lua | |
parent | fea027821633ef07c5f702a9fe7eb65952f5a4b2 (diff) | |
download | lua-language-server-fea133554b47ac6aef9a55d53e3f694311b10fcd.zip |
stash
Diffstat (limited to 'script/core/noder.lua')
-rw-r--r-- | script/core/noder.lua | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index e6c7581f..5805aafc 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -8,9 +8,11 @@ local LAST_REGEX = SPLIT_CHAR .. '[^' .. SPLIT_CHAR .. ']*$' local FIRST_REGEX = '^[^' .. SPLIT_CHAR .. ']*' local ANY_FIELD_CHAR = '*' local RETURN_INDEX = SPLIT_CHAR .. '#' -local PARAM_INDEX = SPLIT_CHAR .. '@' +local PARAM_INDEX = SPLIT_CHAR .. '&' local TABLE_KEY = SPLIT_CHAR .. '<' local ANY_FIELD = SPLIT_CHAR .. ANY_FIELD_CHAR +local URI_CHAR = '@' +local URI_REGEX = URI_CHAR .. '([^' .. URI_CHAR .. ']*)' .. URI_CHAR .. '(.*)' ---@class node -- 当前节点的id @@ -253,7 +255,11 @@ local function checkMode(source) return 'gc:' end if source.type == 'generic.value' then - return 'gv:' + local id = 'gv:' + if guide.getUri(source.closure.call) ~= guide.getUri(source.proto) then + id = URI_CHAR .. guide.getUri(source.closure.call) .. URI_CHAR .. id + end + return id end if isGlobal(source) then return 'g:' @@ -836,6 +842,15 @@ function m.getLastID(id) return lastID end +---把形如 `@file:\\\XXXXX@gv:1|1`拆分成uri与id +---@param id string +---@return uri? string +---@return string id +function m.getUriAndID(id) + local uri, newID = id:match(URI_REGEX) + return uri, newID +end + ---是否是全局变量(包括 _G.XXX 形式) ---@param source parser.guide.object ---@return boolean |