-
Couldn't load subscription status.
- Fork 239
Description
What's up?
After @aljazerzen built the foundations of this, I have filled a few gaps, and now all the examples format into correct PRQL. But we still have a few gaps in getting to something we can use everywhere.
In order to roll this out fully, it's quite important to be close to 100%, since all PRQL will be formatted this way — in the book, whenever someone saves a file in VS Code, whenever someone runs pre-commit (both in our repo and others'), etc. Without being close to 100%, it's not that instrumentally useful.
- We currently remove comments!
- Do we want to elide parentheses around function calls in
{x = (sum foo)}(from feat: FormatUnOpcorrectly #2803 (comment)). This in the docs here. It might require understanding the grandparent node (need to think more) -
modulebreaks, which breaks the standard library (though I actually thought we were only going to do files as modules @aljazerzen ?) feat: codegen for module, type and annotations #2949 - Do we want
from t=tracksorfrom t = tracks? I marginally preferred the former — given that we have fairly few separators, having tighter expressions groups things better. (but this is not a strong view, maybe +0.3, and only aesthetics) style: Usefoo=barstyle in codegen #2779 - Do we want to break inner transforms at all? e.g. this is a lot on one line. But I think my reaction is mostly based on what I'm used to, and I don't think there would be a good rule that lets us handle inner transforms differently. Though we could linebreak earlier (e.g. line break at 40) feat: improve codegen #2950
prql/prql-compiler/tests/integration/snapshots/integration__fmt@distinct_on.prql.snap
Line 8 in 31c3e71
group {genre_id, media_type_id} (sort {(-album_id)} | take 1) -
{(-foo)}has extra parentheses, :— feat: Formatprql/prql-compiler/tests/integration/snapshots/integration__fmt@distinct_on.prql.snap
Lines 8 to 9 in 31c3e71
group {genre_id, media_type_id} (sort {(-album_id)} | take 1) sort {(-genre_id), media_type_id} UnOpcorrectly #2803