Skip to content

#2346 redone: a formatter for Rascal itself, plus the necessary improvements and stabilization in the Box formatter framework code.#2738

Merged
jurgenvinju merged 24 commits intomainfrom
second-try-rascal-formatter
May 5, 2026
Merged

#2346 redone: a formatter for Rascal itself, plus the necessary improvements and stabilization in the Box formatter framework code.#2738
jurgenvinju merged 24 commits intomainfrom
second-try-rascal-formatter

Conversation

@jurgenvinju
Copy link
Copy Markdown
Member

@jurgenvinju jurgenvinju commented Mar 31, 2026

This is a redo of #2346 which was mangled due to a wrong use of git-filter-repo.

Rascal is a pretty big language so this pushes the new toBox and format and layoutDiff functions to the max.

  • The goal is to formulate toBox rules such that the formatter produces beautiful layout, and
  • We identify bugs and efficiency issues in toBox, format and layoutDiff and fix them immediately.
  • We add box operators with variable argument lists to eliminate a level of superfluous brackets
  • We test for exceptions, parse errors and comment preservation, on all files of the standard library and the larger files in the Compiler and checker.
  • re-implementation (optimized) of U and G
  • integration tests succeed https://github.com/usethesource/rascal-core-big-tests/actions/runs/23592431666

@jurgenvinju jurgenvinju changed the title Another clean PR branch to work with for the formatter" Redo #2346 formatter branch Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46%. Comparing base (3846a40) to head (60002de).

Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2738   +/-   ##
=======================================
  Coverage       46%     46%           
- Complexity    6728    6737    +9     
=======================================
  Files          794     794           
  Lines        65923   65936   +13     
  Branches      9888    9888           
=======================================
+ Hits         30839   30857   +18     
+ Misses       32699   32691    -8     
- Partials      2385    2388    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/org/rascalmpl/library/analysis/diff/edits/ExecuteTextEdits.rsc Outdated
Comment thread src/org/rascalmpl/library/analysis/diff/edits/HiFiLayoutDiff.rsc Outdated
Comment thread src/org/rascalmpl/library/lang/rascal/format/Rascal.rsc Outdated
Comment thread src/org/rascalmpl/library/lang/rascal/grammar/definition/Priorities.rsc Outdated
Comment thread src/org/rascalmpl/library/util/Highlight.rsc
Comment thread src/org/rascalmpl/library/IO.rsc Outdated
Comment thread src/org/rascalmpl/library/util/Monitor.rsc
Comment thread src/org/rascalmpl/library/List.rsc
Comment thread src/org/rascalmpl/library/Type.rsc
@jurgenvinju
Copy link
Copy Markdown
Member Author

jurgenvinju commented Apr 19, 2026

thanks for the review @toinehartman . Before we merge, some of the TODOs @toinehartman highlighted should be checked. See the conversation above.

@jurgenvinju jurgenvinju changed the title Redo #2346 formatter branch #2346 redone: a formatter for Rascal itself, plus the necessary improvements and stabilization in the Box formatter framework code. Apr 20, 2026
@jurgenvinju jurgenvinju self-assigned this Apr 21, 2026
@jurgenvinju jurgenvinju requested a review from DavyLandman April 21, 2026 08:30
@jurgenvinju
Copy link
Copy Markdown
Member Author

@DavyLandman this seems ready. lots of fixes in Box-related code, fixed in layoutDif, and new features for Rascal formatting.

Copy link
Copy Markdown
Member

@toinehartman toinehartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see the declarative formatting nearing completion! I just have some small remarks.

Comment thread src/org/rascalmpl/library/analysis/diff/edits/HiFiLayoutDiff.rsc Outdated
Comment thread src/org/rascalmpl/library/lang/box/syntax/Box.rsc Outdated
Comment thread src/org/rascalmpl/library/lang/box/syntax/Box.rsc
Comment thread src/org/rascalmpl/library/lang/box/util/Box2Text.rsc
Comment thread src/org/rascalmpl/library/lang/box/util/Tree2Box.rsc
Comment thread src/org/rascalmpl/library/lang/rascal/format/Grammar.rsc Outdated
Comment thread src/org/rascalmpl/library/lang/rascal/format/Rascal.rsc Outdated
Comment thread src/org/rascalmpl/library/lang/rascal/syntax/RascalParser.java
Comment thread src/org/rascalmpl/library/util/Formatters.rsc
Comment thread src/org/rascalmpl/library/util/Highlight.rsc Outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@jurgenvinju jurgenvinju merged commit 8ae6ced into main May 5, 2026
9 checks passed
@jurgenvinju jurgenvinju deleted the second-try-rascal-formatter branch May 5, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants