Skip to content

Commit

Permalink
fix semantic token for tablefield with function
Browse files Browse the repository at this point in the history
fix #1767
  • Loading branch information
sumneko committed Dec 16, 2022
1 parent 7075ca1 commit caa8c1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* `FIX` [#831]
* `FIX` [#1729]
* `FIX` [#1751]
* `FIX` [#1767]

[#831]: https://github.com/sumneko/lua-language-server/issues/831
[#1729]: https://github.com/sumneko/lua-language-server/issues/1729
[#1751]: https://github.com/sumneko/lua-language-server/issues/1751
[#1767]: https://github.com/sumneko/lua-language-server/issues/1767

`2022-11-29`
## 3.6.4
Expand Down
16 changes: 8 additions & 8 deletions script/core/semantic-tokens.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,21 @@ local Care = util.switch()
if not options.variable then
return
end
local modifiers = 0
if source.parent and source.parent.type == 'tablefield' then
modifiers = define.TokenModifiers.declaration
end
if source.parent then
if source.parent.type == 'tablefield' then
results[#results+1] = {
start = source.start,
finish = source.finish,
type = define.TokenTypes.property,
}
return
end
local value = source.parent.value
if value and value.type == 'function' then
results[#results+1] = {
start = source.start,
finish = source.finish,
type = define.TokenTypes.method,
modifieres = modifiers,
}
return
end
Expand All @@ -86,7 +89,6 @@ local Care = util.switch()
start = source.start,
finish = source.finish,
type = define.TokenTypes.method,
modifieres = modifiers,
}
return
end
Expand All @@ -95,15 +97,13 @@ local Care = util.switch()
start = source.start,
finish = source.finish,
type = define.TokenTypes.method,
modifieres = modifiers,
}
return
end
results[#results+1] = {
start = source.start,
finish = source.finish,
type = define.TokenTypes.property,
modifieres = modifiers,
}
end)
: case 'local'
Expand Down

0 comments on commit caa8c1e

Please sign in to comment.