summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/completion.lua3
-rw-r--r--script/parser/guide.lua10
-rw-r--r--test/hover/init.lua2
3 files changed, 14 insertions, 1 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index b1610ff0..9f622cc9 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -970,6 +970,9 @@ local function checkTypingEnum(ast, text, offset, infers, str, results)
end
local myResults = {}
mergeEnums(myResults, enums, str)
+ table.sort(myResults, function (a, b)
+ return a.label < b.label
+ end)
for _, res in ipairs(myResults) do
results[#results+1] = res
end
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 31bc1a30..bdcec0c2 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -1815,6 +1815,7 @@ function m.searchSameFieldsCrossMethod(status, ref, start, pushQueue)
end
local function checkSameSimpleAndMergeFunctionReturnsByDoc(status, results, source, index, args)
+ source = m.getObjectValue(source) or source
if not source or source.type ~= 'function' then
return
end
@@ -2243,6 +2244,7 @@ function m.pushResult(status, mode, ref, simple)
results[#results+1] = ref
elseif ref.type == 'doc.type.function'
or ref.type == 'doc.class.name'
+ or ref.type == 'doc.alias.name'
or ref.type == 'doc.field' then
results[#results+1] = ref
end
@@ -2285,6 +2287,7 @@ function m.pushResult(status, mode, ref, simple)
end
elseif ref.type == 'doc.type.function'
or ref.type == 'doc.class.name'
+ or ref.type == 'doc.alias.name'
or ref.type == 'doc.field' then
results[#results+1] = ref
end
@@ -3156,6 +3159,13 @@ function m.inferCheckDoc(status, source)
end
return true
end
+ if source.type == 'doc.alias.name' then
+ local results = m.getDocTypeNames(status, m.getDocState(source).extends)
+ for _, res in ipairs(results) do
+ status.results[#status.results+1] = res
+ end
+ return true
+ end
end
function m.getVarargDocType(status, source)
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 8f6a541f..5b3acded 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1264,7 +1264,7 @@ end
local <?x?> = f()
]]
[[
-local x: integer
+local x: any
]]
TEST [[