Repository navigation
Pass all options to Pico formatter - #2939
toinehartman wants to merge 1 commit into
Conversation
toinehartman
commented
Oct 19, 2026
- Pass all formatting options through the recursive calls of the Pico formatting library/example.
- Document some undocumented formatter rules, so the respective page on the website is more accurate.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2939 +/- ##
=======================================
- Coverage 45% 45% -1%
Complexity 6807 6807
=======================================
Files 844 844
Lines 68823 68823
Branches 10038 10038
=======================================
- Hits 31415 31411 -4
- Misses 35005 35010 +5
+ Partials 2403 2402 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Maybe we should move all of pico under the |
|
|
||
| @synopsis{Format while} | ||
| Box toBox((Statement) `while <Expression e> do <{Statement ";"}* block> od`) | ||
| Box toBox((Statement) `while <Expression e> do <{Statement ";"}* block> od`, FormattingOptions opts = fo()) |
There was a problem hiding this comment.
toBox only implements the styling options for case-insensitive literals. On the otherhand these and all the other options are picked up by str format(Box, FormattingOptions opts=fo()) and layoutDiff
There was a problem hiding this comment.
To pick up the options, pass them to fileFormatter, which passes them to fileEditFormatter which passes them to format and layoutDiff. You also see how needsConfirmation is passed into the file patch API.
void(loc) fileFormatter(type[&G <: Tree] grammar, Style style, FormattingOptions opts=fo()) {
list[TextEdit](loc) toEdits = fileEditFormatter(grammar, style, opts=opts);
return void (loc input) {
executeFileSystemChanges([changed(input, toEdits(input), needsConfirmation=opts.needsConfirmation)]);
};
}
jurgenvinju
left a comment
There was a problem hiding this comment.
Better demonstrate without the opts for toBox since that is almost a noop for most languages and a lot of wiring for every recursive call.


