This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
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
crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap
crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap
<<<ROME_RANGE_START>>>
and<<<ROME_RANGE_END>>>
for snapshot testing.UPD:
Let say we want to format with range
range = 5..94
this code:We need to calculate
source
anddest
ranges.source
range we use to find a position in the source text where we need to replace the substring.dest
range we use to get the substring from the formatted code that we need to replace in the source text.The example has a problem for the right end. We get the result:
it has the following source map:
We can solve the issue by checking markers with the same dest but a greater source.
The same logic we can apply for a left side.
Test Plan
cargo test
Documentation