diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/definition.lua | 4 | ||||
-rw-r--r-- | script/vm/compiler.lua | 1 | ||||
-rw-r--r-- | script/vm/ref.lua | 2 | ||||
-rw-r--r-- | test/definition/luadoc.lua | 12 |
5 files changed, 18 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index 469e95ad..2ef507b1 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * `NEW` code lens. This feature is disabled by default. * `NEW` settings: * `Lua.codeLens.enable`: Enable code lens. +* `CHG` supports finding definition for `@class` and `@alias`, since they may defined multi times. * `FIX` [#831] * `FIX` [#1729] * `FIX` [#1737] diff --git a/script/core/definition.lua b/script/core/definition.lua index 11da994a..3619916e 100644 --- a/script/core/definition.lua +++ b/script/core/definition.lua @@ -205,7 +205,9 @@ return function (uri, offset) or src.type == 'doc.enum.name' then if source.type ~= 'doc.type.name' and source.type ~= 'doc.extends.name' - and source.type ~= 'doc.see.name' then + and source.type ~= 'doc.see.name' + and source.type ~= 'doc.class.name' + and source.type ~= 'doc.alias.name' then goto CONTINUE end end diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 446c357e..c8323a49 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1626,6 +1626,7 @@ local compilerSwitch = util.switch() end end) : case 'doc.class.name' + : case 'doc.alias.name' : call(function (source) vm.setNode(source, vm.compileNode(source.parent)) end) diff --git a/script/vm/ref.lua b/script/vm/ref.lua index 2740666b..012cfd28 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -86,7 +86,7 @@ local function searchWord(source, pushResult, defMap, fileNotify) if not text then return end - if not text:match(key) then + if not text:find(key, 1, true) then return end local state = files.getState(uri) diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index ae2c8e61..b877f5cd 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -975,3 +975,15 @@ print(x.<?a?>) ]] config.set(nil, 'Lua.type.castNumberToInteger', true) + +TEST [[ +---@class <!A!> + +---@class <!<?A?>!> +]] + +TEST [[ +---@alias <!A!> number + +---@alias <!<?A?>!> number +]] |