Skip to content

(fix) better fix range handling #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2022
Merged

Conversation

dummdidumm
Copy link
Member

Fixes don't need to start at the same line where the error message is shown, and they don't need to be at the same line as the start of the error message. Therefore the previous handling of re-adding dedents was flawed. Instead, map the range to positions (line/character) and use them to find the correct dedent offsets.
Additionally add indentation after each newline a fix has because the fix doesn't know about the additional indentation.

To properly test fixes, the test setup was enhanced. If there's a Fixed.svelte, that one will be compared against a fixed version of Input.svelte.

Fixes #110
Fixes #156
Fixes #157

Fixes don't need to start at the same line where the error message is shown, and they don't need to be at the same line as the start of the error message. Therefore the previous handling of re-adding dedents was flawed. Instead, map the range to positions (line/character) and use them to find the correct dedent offsets.
Additionally add indentation after each newline a fix has because the fix doesn't know about the additional indentation.

To properly test fixes, the test setup was enhanced. If there's a Fixed.svelte, that one will be compared against a fixed version of Input.svelte.

Fixes sveltejs#110
Fixes sveltejs#156
Fixes sveltejs#157
@dummdidumm dummdidumm merged commit 7975e00 into sveltejs:master Jan 5, 2022
@dummdidumm dummdidumm deleted the fix-range branch January 5, 2022 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using no-lonely-if makes code broken Using no-else-return makes code broken Breaks multiline autofixes
1 participant