{{ message }}
Repository navigation
fix: handle leading trivia when replacing a range in a syntax list - #1694
Open
kerdofficial wants to merge 1 commit into
Open
kerdofficial wants to merge 1 commit into
kerdofficial wants to merge 1 commit into
Conversation
This branch has not been deployed
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.

Fixes #613
After removing the only import with
replaceWithText(""), the file starts with whitespace (console.log(qux);).fixMissingImports()then inserts an import at position 0 and fails with "Manipulation error: Error replacing tree: The children of the old and new trees were expected to have the same count (1:2)".RangeHandlerlooks for the node that contains the changed range by comparinggetStart(), which skips leading trivia. The statement list's start is after the whitespace, so it was treated as an unchanged sibling instead of the container. It now also matches aSyntaxListby its full start.Added a test for the case in the issue. It fails without the change and also checks that the existing statement and syntax list nodes are kept.
deno task test,deno task code-verificationanddeno task type-checkpass.