diff options
-rw-r--r-- | script-beta/core/completion.lua | 2 | ||||
-rw-r--r-- | script-beta/core/hover/table.lua | 7 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 10 |
3 files changed, 17 insertions, 2 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 351f09c3..b4baace2 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -141,7 +141,7 @@ local function buildFunctionSnip(source, oop) local defs = vm.getDefs(source) local args = '' for _, def in ipairs(defs) do - local defArgs = getArg(def) + local defArgs = getArg(def, oop) if defArgs ~= '' then args = defArgs break diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua index 63ad800e..69cb84d3 100644 --- a/script-beta/core/hover/table.lua +++ b/script-beta/core/hover/table.lua @@ -31,6 +31,10 @@ local function getKey(src) end local function getField(src) + if src.type == 'table' + or src.type == 'function' then + return nil + end if src.parent.type == 'tableindex' or src.parent.type == 'setindex' or src.parent.type == 'getindex' then @@ -111,6 +115,9 @@ return function (source) local classes = {} vm.eachField(source, function (src) local key, class, literal = getField(src) + if not key then + return + end if not classes[key] then classes[key] = {} end diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 84878f4d..1e548b9d 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1563,6 +1563,8 @@ function m.pushResult(status, mode, ref, simple) if ref.node.special == 'rawset' then results[#results+1] = ref end + elseif ref.type == 'function' then + results[#results+1] = ref elseif ref.type == 'table' then results[#results+1] = ref elseif ref.type == 'library' then @@ -1621,6 +1623,8 @@ function m.pushResult(status, mode, ref, simple) elseif ref.type == 'setglobal' or ref.type == 'getglobal' then results[#results+1] = ref + elseif ref.type == 'function' then + results[#results+1] = ref elseif ref.type == 'table' then results[#results+1] = ref elseif ref.type == 'call' then @@ -2501,13 +2505,17 @@ function m.inferByDef(status, obj) if status.index > 1 then return end + local mark = {} local newStatus = m.status(nil, status.interface) m.searchRefs(newStatus, obj, 'def') for _, src in ipairs(newStatus.results) do local inferStatus = m.status(status) m.searchInfer(inferStatus, src) for _, infer in ipairs(inferStatus.results) do - status.results[#status.results+1] = infer + if not mark[infer.source] then + mark[infer.source] = true + status.results[#status.results+1] = infer + end end end end |