summaryrefslogtreecommitdiff
path: root/script/vm/getDocs.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-10 10:19:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-10 10:19:42 +0800
commitd7ab66b25db024f2cb375192f36d3c72313e0e34 (patch)
treee63320e3c127fdd438b7c708989ed5f84771406d /script/vm/getDocs.lua
parentf616bd2baf6a03324d1d5d6df90607f770ea0a51 (diff)
downloadlua-language-server-d7ab66b25db024f2cb375192f36d3c72313e0e34.zip
cleanup
Diffstat (limited to 'script/vm/getDocs.lua')
-rw-r--r--script/vm/getDocs.lua28
1 files changed, 21 insertions, 7 deletions
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua
index ba4fb560..8ee942d1 100644
--- a/script/vm/getDocs.lua
+++ b/script/vm/getDocs.lua
@@ -12,18 +12,32 @@ local noder = require 'core.noder'
---@param name? string
---@return parser.guide.object[]
function vm.getDocDefines(name)
- name = name or ''
local cache = vm.getCache 'getDocDefines'
if cache[name] then
return cache[name]
end
local results = {}
- local id = 'def:dn:' .. name
- for noders in collector.each(id) do
- for source in noder.eachSource(noders, id) do
- if source.type == 'doc.class.name'
- or source.type == 'doc.alias.name' then
- results[#results+1] = source
+ if name == '*' then
+ for noders in collector.each('def:dn:') do
+ for id in noder.eachID(noders) do
+ if id:sub(1, 3) == 'dn:'
+ and not id:find(noder.SPLIT_CHAR) then
+ for source in noder.eachSource(noders, id) do
+ if guide.isSet(source) then
+ results[#results+1] = source
+ end
+ end
+ end
+ end
+ end
+ else
+ local id = 'dn:' .. name
+ for noders in collector.each('def:' .. id) do
+ for source in noder.eachSource(noders, id) do
+ if source.type == 'doc.class.name'
+ or source.type == 'doc.alias.name' then
+ results[#results+1] = source
+ end
end
end
end