From e7c4777ace613736d101927ccc6f5c877f89a611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 22 Jun 2022 14:32:11 +0800 Subject: fix --- script/vm/compiler.lua | 14 +++++++++----- test/hover/init.lua | 42 +++++++++++++++++++++++++++++++++++++++++- 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 = (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 +]] +[[ +local t: A { + x: integer, + y: boolean = true, +} +]] -- cgit v1.2.3