summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-04-25 20:02:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-04-25 20:02:58 +0800
commit8d88cec860af5a594d120ab4e37d4cb47ac1f238 (patch)
treef00b8bd7d297eaf15c101719b14b36ed00e1d79f
parent71885b139cdae9f3d65268278882bd4793f4fe24 (diff)
downloadlua-language-server-8d88cec860af5a594d120ab4e37d4cb47ac1f238.zip
fix first semantic token is dropped
fix #2081
-rw-r--r--changelog.md2
-rw-r--r--script/core/semantic-tokens.lua4
2 files changed, 4 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 325a0a15..c17cdff0 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,9 +4,11 @@
* `FIX` commandline parameter `checklevel` may not work
* `FIX` [#2036]
* `FIX` [#2037]
+* `FIX` [#2081]
[#2036]: https://github.com/LuaLS/lua-language-server/issues/2036
[#2037]: https://github.com/LuaLS/lua-language-server/issues/2037
+[#2081]: https://github.com/LuaLS/lua-language-server/issues/2081
## 3.6.18
`2023-3-23`
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 0e27e8b8..4d191b69 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -711,7 +711,7 @@ local function buildTokens(state, results)
local lastLine = 0
local lastStartChar = 0
local index = 0
- for _, source in ipairs(results) do
+ for i, source in ipairs(results) do
local startPos = source.start
local finishPos = source.finish
local line = startPos.line
@@ -720,7 +720,7 @@ local function buildTokens(state, results)
local deltaStartChar
if deltaLine == 0 then
deltaStartChar = startChar - lastStartChar
- if deltaStartChar == 0 then
+ if deltaStartChar == 0 and i > 1 then
goto continue
end
else