Fix multiline semantic token encoding in heredoc#2100
Open
arnaud-dezandee wants to merge 1 commit intohashicorp:mainfrom
Open
Fix multiline semantic token encoding in heredoc#2100arnaud-dezandee wants to merge 1 commit intohashicorp:mainfrom
arnaud-dezandee wants to merge 1 commit intohashicorp:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Alternative to #2095.
This fixes the same multiline semantic token encoding bug, but takes a slightly broader approach. In addition to fixing the bad delta anchor after multiline token emission, it also fixes how multiline token segments are sliced per line.
I hit this while reproducing broken Terraform heredoc highlighting in VS Code.
What changed
Why not just #2095
#2095 fixes the overflow symptom. This PR is an alternative that also fixes the multiline slicing itself. While testing, I found the encoder was over-reporting the first emitted line length for multiline tokens that start late on a line, so I updated the existing multiline test as well.
Validation
PCI review checklist
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.