Format multi-line string contents#270
Merged
zaneduffield merged 3 commits intoSep 29, 2025
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
zaneduffield
commented
Aug 27, 2025
55e6b15 to
b1b5795
Compare
jgardn3r
requested changes
Sep 2, 2025
b1b5795 to
97cf22d
Compare
040b85f to
ec60448
Compare
jgardn3r
requested changes
Sep 29, 2025
jgardn3r
left a comment
Collaborator
There was a problem hiding this comment.
Getting really close, I think.
1. Indentation is normalised to align the trailing quote with the leading quote. Lines in the middle are adjusted to retain their original significant leading whitespace. 2. Internal line endings are normalised to match the configured line ending. 3. Invalid multiline strings are left untouched.
ec60448 to
3f019ee
Compare
jgardn3r
approved these changes
Sep 29, 2025
9fb4f05
into
integrated-application-development:master
7 checks passed
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.
This PR adds support for formatting the interior contents of multi-line strings.
A setting has been added to control the behaviour (
format_multiline_strings), and it defaults totrue. I have enabled this by default because I'm confident in the initial implementation, and we should continue with our stated goal of "format the entire file".Before implementing this, I had to do some testing to confirm some of the fine-grained details.
My findings are asserted in this script, which can be summarised as
\ris considered to end the line{$TEXTBLOCK}directive, so it is safe to change themWith these findings, I implemented the normalisation as follows
With the interior of multiline strings be mutated, the cursor relocation was broken when inside such tokens. This has been fixed, and the new algorithm will maintain the number of line breaks relative to the end of the token as well as the number of bytes from the end of the relevant line.
Closes #238