From d12fb5e6b1d3b27fe33c04bc557a970f9c4ccb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 29 Mar 2022 02:10:39 +0800 Subject: update --- script/core/reference.lua | 1 + script/vm/compiler.lua | 4 +++ test/references/all.lua | 2 +- test/references/common.lua | 76 ++++++++++------------------------------------ 4 files changed, 22 insertions(+), 61 deletions(-) diff --git a/script/core/reference.lua b/script/core/reference.lua index 1e1b8e11..c7fa7782 100644 --- a/script/core/reference.lua +++ b/script/core/reference.lua @@ -105,6 +105,7 @@ return function (uri, position) or src.type == 'doc.type.name' or src.type == 'doc.extends.name' then if source.type ~= 'doc.type.name' + and source.type ~= 'doc.class.name' and source.type ~= 'doc.extends.name' and source.type ~= 'doc.see.name' then goto CONTINUE diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 700de562..427b927f 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -747,6 +747,10 @@ local compilerMap = util.switch() end end end) + : case 'doc.class.name' + : call(function (source) + nodeMgr.setNode(source, m.compileNode(source.parent)) + end) : case 'doc.field' : call(function (source) nodeMgr.setNode(source, m.compileNode(source.extends)) diff --git a/test/references/all.lua b/test/references/all.lua index 4ba63579..5d92508d 100644 --- a/test/references/all.lua +++ b/test/references/all.lua @@ -28,7 +28,7 @@ return a.x, b. TEST [[ local = {} function :x() - :x() + self:x() end ]] diff --git a/test/references/common.lua b/test/references/common.lua index 2331aa91..74ce391a 100644 --- a/test/references/common.lua +++ b/test/references/common.lua @@ -131,56 +131,12 @@ a..c = 1 print(a.!>.c) ]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) -TEST [[ -local -local t = { - = -} -print(t.) -]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) - -TEST [[ -local -local = -]] - -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) -TEST [[ -local -a. = -]] - -TEST [[ -. = -]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) - -TEST [[ -local -local = -]] - -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) -TEST [[ -local -. = -]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) - TEST [[ _G. = 1 print() ]] -TEST [[ ----@class ----@type ----@type -]] - TEST [[ ---@class ---@type @@ -191,19 +147,19 @@ TEST [[ ---@class Class local ---@type Class -local +local x ]] TEST [[ ---@class Class -local +local t ---@type Class local ]] -- BUG TEST [[ ----@return +---@return !> function f() end ]] @@ -215,16 +171,16 @@ TEST [[ local ]] -TEST [[ ----@class A -local a - ----@type A -local b - ----@type A -local c - -b. = 1 -c. = 1 -]] +--TEST [[ +-----@class A +--local a +-- +-----@type A +--local b +-- +-----@type A +--local c +-- +--b. = 1 +--c. = 1 +--]] -- cgit v1.2.3