summaryrefslogtreecommitdiff
path: root/script/core/semantic-tokens.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-21 18:22:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-21 18:22:41 +0800
commit8ba44c3e21ac761b88226fec0cc8a5347a4a5804 (patch)
treedcc3ef284b0eb7f08f91899eb6d3eb48cd55c997 /script/core/semantic-tokens.lua
parentcc6142db768430288fa71e144ba479a7a0e6e420 (diff)
downloadlua-language-server-8ba44c3e21ac761b88226fec0cc8a5347a4a5804.zip
#1080 using `---@overload` as class constructor
Diffstat (limited to 'script/core/semantic-tokens.lua')
-rw-r--r--script/core/semantic-tokens.lua26
1 files changed, 11 insertions, 15 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 568bb222..3b7b77ee 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -165,21 +165,17 @@ local Care = util.switch()
-- 5. Class declaration
-- only search this local
if loc.bindDocs then
- for i = #loc.bindDocs, 1, -1 do
- local doc = loc.bindDocs[i]
- if doc.type == 'doc.type' then
- break
- end
- if doc.type == "doc.class" and doc.bindSources then
- for _, src in ipairs(doc.bindSources) do
- if src == loc then
- results[#results+1] = {
- start = source.start,
- finish = source.finish,
- type = define.TokenTypes.class,
- }
- return
- end
+ local isParam = source.parent.type == 'funcargs'
+ or source.parent.type == 'in'
+ if not isParam then
+ for _, doc in ipairs(loc.bindDocs) do
+ if doc.type == 'doc.class' then
+ results[#results+1] = {
+ start = source.start,
+ finish = source.finish,
+ type = define.TokenTypes.class,
+ }
+ return
end
end
end