diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-01 14:52:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-01 14:52:45 +0800 |
commit | f050b38fd69bd1c90b99b536f89f8036c9f4fc3a (patch) | |
tree | f0564c91d20fbb9e26aad2b315df9aad4ff747e7 /script/vm | |
parent | ae95f749532c2252c671d1b3cab73d7e18cf777c (diff) | |
download | lua-language-server-f050b38fd69bd1c90b99b536f89f8036c9f4fc3a.zip |
update search reference
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/compiler.lua | 4 | ||||
-rw-r--r-- | script/vm/def.lua | 4 | ||||
-rw-r--r-- | script/vm/ref.lua | 21 |
3 files changed, 29 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 69cfdc55..a38329f8 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1610,6 +1610,10 @@ local compilerSwitch = util.switch() end vm.setNode(source, fieldNode) end) + : case 'doc.field.name' + : call(function (source) + vm.setNode(source, vm.compileNode(source.parent)) + end) : case 'doc.type.field' : call(function (source) if not source.extends then diff --git a/script/vm/def.lua b/script/vm/def.lua index 7ce8ad7a..b1bedc43 100644 --- a/script/vm/def.lua +++ b/script/vm/def.lua @@ -19,6 +19,10 @@ simpleSwitch = util.switch() pushResult(loc) end end) + : case 'doc.field' + : call(function (source, pushResult) + pushResult(source) + end) ---@param source parser.object ---@param pushResult fun(src: parser.object) diff --git a/script/vm/ref.lua b/script/vm/ref.lua index 0135d11f..247fb4db 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -26,6 +26,19 @@ simpleSwitch = util.switch() end end end) + : case 'doc.alias.name' + : call(function (source, pushResult) + local global = vm.getGlobal('type', source[1]) + if not global then + return + end + for _, get in ipairs(global:getGets(guide.getUri(source))) do + pushResult(get) + end + for _, set in ipairs(global:getSets(guide.getUri(source))) do + pushResult(set) + end + end) ---@async local function searchInAllFiles(suri, searcher, notify) @@ -173,6 +186,11 @@ local nodeSwitch = util.switch() : call(function (source, pushResult, defMap, fileNotify) searchField(source, pushResult, defMap, fileNotify) end) + : case 'doc.field.name' + ---@async + : call(function (source, pushResult, defMap, fileNotify) + searchField(source, pushResult, defMap, fileNotify) + end) : case 'function' : case 'doc.type.function' ---@async @@ -237,6 +255,9 @@ local function searchByDef(source, pushResult) or source.type == 'method' then source = source.parent end + if source.type == 'doc.field.name' then + source = source.parent + end defMap[source] = true if guide.isSet(source) then local defs = vm.getDefs(source) |