fix(ast_tools): fix formatting of variants#17173
Merged
graphite-app[bot] merged 1 commit intomainfrom Dec 20, 2025
Merged
Conversation
This was referenced Dec 20, 2025
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the formatting of generated JavaScript files by improving how line breaks are inserted before top-level declarations. Previously, line breaks were inserted directly before export, function, class, const, or let keywords. The new implementation inserts line breaks before any comments that precede these statements, producing cleaner output.
Key Changes:
- Updated regex pattern to match and preserve comments preceding export/function/class/const/let declarations
- Simplified replacement logic from a match-based approach to a single format string
- Updated documentation to explain the new regex behavior
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daabe4a to
101b8a6
Compare
4e99696 to
fff03fc
Compare
Contributor
Merge activity
|
Fix formatting of generated JS files. Previously we inserted line breaks before top-level `export` statements. Now insert the line break before any comments that precede those statements. This produces nicer output.
fff03fc to
472c439
Compare
101b8a6 to
bc8ab2e
Compare
Base automatically changed from
om/12-19-refactor_ast_tools_simplify_generating_variants_of_code
to
main
December 20, 2025 14:07
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.

Fix formatting of generated JS files. Previously we inserted line breaks before top-level
exportstatements. Now insert the line break before any comments that precede those statements. This produces nicer output.