Skip to content

Commit a3f5b1c

Browse files
committed
fix semantic of function
1 parent e9ed7d7 commit a3f5b1c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
+ `type-check`: removed for now
77
+ `no-implicit-any`: renamed to `no-unknown`
88
* `CHG` formatter: no longer need` --preview`
9+
* `FIX` semantic: color of `function`
910
* `FIX` [#1028](https://github.com/sumneko/lua-language-server/issues/1028)
1011

1112
## 2.6.8

script/core/semantic-tokens.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,14 @@ local Care = util.switch()
119119
end
120120
local loc = source.node or source
121121
-- 1. 值为函数的局部变量 | Local variable whose value is a function
122-
if loc.refs then
123-
for _, ref in ipairs(loc.refs) do
122+
if loc.ref then
123+
for _, ref in ipairs(loc.ref) do
124124
if ref.value and ref.value.type == 'function' then
125125
results[#results+1] = {
126126
start = source.start,
127127
finish = source.finish,
128128
type = define.TokenTypes['function'],
129+
modifieres = define.TokenModifiers.declaration,
129130
}
130131
return
131132
end
@@ -184,7 +185,7 @@ local Care = util.switch()
184185
start = source.start,
185186
finish = source.finish,
186187
type = define.TokenTypes['function'],
187-
modifieres = source.type == 'setlocal' and define.TokenModifiers.declaration or nil,
188+
modifieres = guide.isSet(source) and define.TokenModifiers.declaration or nil,
188189
}
189190
return
190191
end

0 commit comments

Comments
 (0)