diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-29 20:08:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-29 20:08:00 +0800 |
commit | 0ad52ca53a9e9d24ee9a3451e24ce68f8bee0ff9 (patch) | |
tree | b80ad14b67a19f7a27a7332ec9d1b23d4e8aea64 /script-beta/core/reference.lua | |
parent | 7981076619717ec1cd5c811762f4c60a445f3c8d (diff) | |
download | lua-language-server-0ad52ca53a9e9d24ee9a3451e24ce68f8bee0ff9.zip |
整理代码
Diffstat (limited to 'script-beta/core/reference.lua')
-rw-r--r-- | script-beta/core/reference.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua index 13d698a2..0e3268f5 100644 --- a/script-beta/core/reference.lua +++ b/script-beta/core/reference.lua @@ -71,10 +71,10 @@ return function (uri, offset) local results = {} vm.setSearchLevel(10) - vm.eachRef(source, function (src) + for _, src in ipairs(vm.getRefs(source, 'deep')) do local root = guide.getRoot(src) if not root then - return + goto CONTINUE end if src.type == 'setfield' or src.type == 'getfield' @@ -88,13 +88,14 @@ return function (uri, offset) or src.type == 'setmethod' then src = src.method elseif src.type == 'table' and src.parent.type ~= 'return' then - return + goto CONTINUE end results[#results+1] = { target = src, uri = files.getOriginUri(root.uri), } - end) + ::CONTINUE:: + end if #results == 0 then return nil |