summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/vm/compiler.lua14
-rw-r--r--test/hover/init.lua42
2 files changed, 50 insertions, 6 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index ecaa57dc..795113e0 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -121,17 +121,21 @@ local searchFieldSwitch = util.switch()
if not fields then
return
end
- local hasMarkDoc
+ local hasMarkDoc = {}
for _, src in ipairs(fields) do
if src.bindDocs then
if bindDocs(src) then
- hasMarkDoc = true
- pushResult(src, hasMarkDoc)
+ local skey = guide.getKeyName(src)
+ if skey then
+ hasMarkDoc[skey] = true
+ end
+ pushResult(src, true)
end
end
end
- if not hasMarkDoc then
- for _, src in ipairs(fields) do
+ for _, src in ipairs(fields) do
+ local skey = guide.getKeyName(src)
+ if not hasMarkDoc[skey] then
pushResult(src)
end
end
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 7fec9254..a97cf3ae 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -810,7 +810,28 @@ TEST [[
next: function,
os: oslib,
package: packagelib,
- ...(+22)
+ pairs: function,
+ pcall: function,
+ print: function,
+ rawequal: function,
+ rawget: function,
+ rawlen: function,
+ rawset: function,
+ require: function,
+ select: function,
+ setfenv: function,
+ setmetatable: function,
+ string: stringlib,
+ table: tablelib,
+ tonumber: function,
+ tostring: function,
+ type: function,
+ unpack: function,
+ utf8: utf8lib,
+ warn: function,
+ xpcall: function,
+ _G: _G,
+ _VERSION: string = "Lua 5.4",
}
]]
@@ -1990,3 +2011,22 @@ local n3 = <?f?>(0, 0)
[[
local f: fun(x: number, y: number):string
]]
+
+TEST [[
+---@class A
+local mt
+
+---@type integer
+mt.x = 1
+
+mt.y = true
+
+---@type A
+local <?t?>
+]]
+[[
+local t: A {
+ x: integer,
+ y: boolean = true,
+}
+]]