Disable auto-wrapping, preserve newlines at wrap positions#10
Draft
Disable auto-wrapping, preserve newlines at wrap positions#10
Conversation
Co-authored-by: johnameyer <3662655+johnameyer@users.noreply.github.com>
Co-authored-by: johnameyer <3662655+johnameyer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Turn off auto-wrapping by default
Disable auto-wrapping, preserve newlines at wrap positions
Feb 1, 2026
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.
Auto-wrapping logic based on line length was causing edge case behavior issues. This changes the formatter to preserve newlines where they exist in the source at wrap positions, rather than automatically inserting them.
Changes
render.rs: Removed line length checking and re-rendering logic fromprettyprint(). Wrap nodes now make a single pass.format_node.rs+transform.rs: Addedhas_newline_in_sourcefield toWrapArguments. Detects newlines at wrap positions by comparing row positions between adjacent nodes during tree transformation.Wrap node rendering: Changed from
should_wrap = parent_wrap.wrap_because_length || parent_wrap.wrap_because_childtoshould_wrap = has_newline_in_source. Newlines are now preserved from source instead of computed from line length.Behavior Change
Before:
After:
Test files updated to reflect correct formatting under new behavior (removed newlines from non-wrap positions, fixed spacing inconsistencies).
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.