diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-17 17:48:58 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-17 17:48:58 +0800 |
commit | 8d2a56d0953a1b62c103296cf48e530b597c453e (patch) | |
tree | 14b7abfdb0e4b329a24fd76b759ab5ada3216c22 /script | |
parent | c7db60b4629f0174da0679d47cbb2f7cb8813ed9 (diff) | |
download | lua-language-server-8d2a56d0953a1b62c103296cf48e530b597c453e.zip |
limited searching across `---@type`
Diffstat (limited to 'script')
-rw-r--r-- | script/core/noder.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index f77ad4b0..40a0bb82 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1067,6 +1067,46 @@ compileNodeMap = util.switch() : call(function (noders, id, source) local uri = guide.getUri(source) collector.subscribe(uri, id, noders) + + local parent = source.parent + if parent.type ~= 'doc.type' then + goto BREAK + end + local bindSources = parent.bindSources + if not bindSources then + goto BREAK + end + for i = 1, #bindSources do + local src = bindSources[i] + if src.type ~= 'local' then + goto CONTINUE1 + end + local refs = src.ref + if not refs then + goto CONTINUE1 + end + for j = 1, #refs do + local ref = refs[j] + if ref.type ~= 'getlocal' then + goto CONTINUE2 + end + local nxt = ref.next + if not nxt then + goto CONTINUE2 + end + local nxtType = nxt.type + if nxtType == 'setfield' + or nxtType == 'setmethod' + or nxtType == 'setindex' then + local defID = 'def:' .. id + collector.subscribe(uri, defID, noders) + goto BREAK + end + ::CONTINUE2:: + end + ::CONTINUE1:: + end + ::BREAK:: end) : case 'doc.class.name' : case 'doc.alias.name' |