Skip to content
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

ScannerTokens: improve obtaining lastNewlinePos #3419

Merged
merged 1 commit into from Dec 27, 2023

Conversation

kitbellew
Copy link
Contributor

Since we had already obtained the current indent position, which points to the final newline (either token or multiline comment), we no longer need to traverse all trivia tokens between prevPos and nextPos and just backtrack from the indent position, to find the EOL token and then again to check whether we have a blank line.

Helps with scalameta/scalafmt#3720.

Since we had already obtained the current indent position, which points
to the final newline (either token or multiline comment), we no longer
need to traverse all trivia tokens between prevPos and nextPos and just
backtrack from the indent position, to find the EOL token and then again
to check whether we have a blank line.
@kitbellew kitbellew merged commit 1f96516 into scalameta:main Dec 27, 2023
24 checks passed
@kitbellew kitbellew deleted the sfmt3720_12 branch December 27, 2023 14:32
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.

None yet

2 participants