Skip to content

Commit f709ab2

Browse files
committed
fix #1348
1 parent 9ba0f94 commit f709ab2

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
* `FIX` [#1320](https://github.com./sumneko/lua-language-server/issues/1320)
7171
* `FIX` [#1330](https://github.com./sumneko/lua-language-server/issues/1330)
7272
* `FIX` [#1346](https://github.com./sumneko/lua-language-server/issues/1346)
73+
* `FIX` [#1348](https://github.com./sumneko/lua-language-server/issues/1348)
7374

7475
## 3.4.2
7576
`2022-7-6`

script/core/semantic-tokens.lua

+9-12
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,16 @@ local Care = util.switch()
134134
return
135135
end
136136
local loc = source.node or source
137+
local uri = guide.getUri(loc)
137138
-- 1. 值为函数的局部变量 | Local variable whose value is a function
138-
if loc.ref then
139-
for _, ref in ipairs(loc.ref) do
140-
if ref.value and ref.value.type == 'function' then
141-
results[#results+1] = {
142-
start = source.start,
143-
finish = source.finish,
144-
type = define.TokenTypes['function'],
145-
modifieres = define.TokenModifiers.declaration,
146-
}
147-
return
148-
end
149-
end
139+
if vm.getInfer(source):hasFunction(uri) then
140+
results[#results+1] = {
141+
start = source.start,
142+
finish = source.finish,
143+
type = define.TokenTypes['function'],
144+
modifieres = define.TokenModifiers.declaration,
145+
}
146+
return
150147
end
151148
-- 3. 特殊变量 | Special variableif source[1] == '_ENV' then
152149
if loc[1] == '_ENV' then

0 commit comments

Comments
 (0)