[tools] gopls/internal/protocol/semtok: fix delta encoding bug

0 views
Skip to first unread message

Alan Donovan (Gerrit)

unread,
5:31 PM (6 hours ago) 5:31 PM
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Madeline Kalil, Go LUCI, Ingo Oeser, golang-co...@googlegroups.com

Alan Donovan submitted the change

Change information

Commit message:
gopls/internal/protocol/semtok: fix delta encoding bug

In the previous implementation, the delta encoding logic
assumed that i==0 when indexing tokens for the line number,
but this is false if the first token was skipped.
This CL rewrites the encoder more simply to avoid the bug.
(+ test)

Also, fix a TODO in Editor.interpretTokens that causes
it to mishandle non-BMP characters, since the Token.Length
field is expressed in UTF-16 code units.
(+ test)

Fixes golang/go#78269
Change-Id: Ia122fe0ed2529ceca17428beb29537f82ab972bd
Reviewed-by: Madeline Kalil <mka...@google.com>
Files:
  • M gopls/internal/protocol/semtok/semtok.go
  • M gopls/internal/test/integration/fake/editor.go
  • M gopls/internal/test/integration/misc/semantictokens_test.go
Change size: M
Delta: 3 files changed, 172 insertions(+), 62 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Madeline Kalil
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Ia122fe0ed2529ceca17428beb29537f82ab972bd
Gerrit-Change-Number: 758100
Gerrit-PatchSet: 7
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-CC: Ingo Oeser <night...@googlemail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages