diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-29 02:10:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-29 02:10:39 +0800 |
commit | d12fb5e6b1d3b27fe33c04bc557a970f9c4ccb4e (patch) | |
tree | 47eec80c3a5678ea4632825fe44393cb5001f26c | |
parent | e745667530f0d4fd340beebc1545f86c76c78af1 (diff) | |
download | lua-language-server-d12fb5e6b1d3b27fe33c04bc557a970f9c4ccb4e.zip |
update
-rw-r--r-- | script/core/reference.lua | 1 | ||||
-rw-r--r-- | script/vm/compiler.lua | 4 | ||||
-rw-r--r-- | test/references/all.lua | 2 | ||||
-rw-r--r-- | 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.<!x!> TEST [[ local <?mt?> = {} function <!mt!>:x() - <!self!>: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,44 +131,6 @@ a.<!b!>.c = 1 print(a.<!<?b?>!>.c) ]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) -TEST [[ -local <?f?> -local t = { - <!a!> = <!f!> -} -print(t.<!a!>) -]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) - -TEST [[ -local <!f!> -local <!t!> = <?f?> -]] - -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) -TEST [[ -local <!f!> -a.<!t!> = <?f?> -]] - -TEST [[ -<!t!>.<!f!> = <?t?> -]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) - -TEST [[ -local <!f!> -local <?t?> = <!f!> -]] - -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) -TEST [[ -local <!t!> -<!t!>.<!f!> = <?t?> -]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) - TEST [[ _G.<?xxx?> = 1 @@ -176,12 +138,6 @@ print(<!xxx!>) ]] TEST [[ ----@class <!Class!> ----@type <?Class?> ----@type <!Class!> -]] - -TEST [[ ---@class <?Class?> ---@type <!Class!> ---@type <!Class!> @@ -191,19 +147,19 @@ TEST [[ ---@class Class local <?t?> ---@type Class -local <!x!> +local x ]] TEST [[ ---@class Class -local <!t!> +local t ---@type Class local <?x?> ]] -- BUG TEST [[ ----@return <?xxx?> +---@return <!<?xxx?>!> function f() end ]] @@ -215,16 +171,16 @@ TEST [[ local <?t?> ]] -TEST [[ ----@class A -local a - ----@type A -local b - ----@type A -local c - -b.<?x?> = 1 -c.<!x!> = 1 -]] +--TEST [[ +-----@class A +--local a +-- +-----@type A +--local b +-- +-----@type A +--local c +-- +--b.<?x?> = 1 +--c.<!x!> = 1 +--]] |