Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column width experiments #3

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open

Column width experiments #3

wants to merge 93 commits into from

Conversation

piegamesde
Copy link
Owner

No description provided.

Lucus16 and others added 30 commits April 6, 2023 12:20
To make more clear that one formats and the other one only checks
Tests mostly imported from Alejandra
- Disallow single-line if statements
- Handle multi-line conditions differently (indent instead of absorb)
- The (from) case needs to be improved
- Somehow it indents the comments *after* the statement now, no idea why or how to fix
The file was identical to diff/idioms_nixos_1 and therefore redundant.
Moreover, we need to also keep a look on the *really* big packages in there,
and Mozilla is a prime example.
Except when that item is another list or attribute set
This is nixos/modules/services/web-apps/nextcloud.nix, so that we have a
big NixOS module in our suite
from not form
There is now the choice whether to pull whitespace just before/at the start of a group
in or out. This allows to fix an outstanding issue with inherit statements, and is also
used in the bindings format
They now get expanded and indented more liberally, with some exceptions.
Things still look weird at places because of parentheses formatting.
With a couple of exceptions, multiline parentheses are now
forced to start on the next line.
It is now even more powerful, although there is still a bit of room for improvement in the future.
In short, it defers merging spacing across group boundaries, allowing groups to start/end with spacing
even if the previous/next token is a whitespace too. Previously, they would get merged, causing weird results.

- Removed mergeSpacings', as it is not needed anymore
- Merged moveLinesOut and mergeSpacings into a single pass "fixup"
- layoutGreedy can now handle some consecutive spacings across group boundaries
  - It still does not handle all cases, only the ones needed for the current features.
    More will be added as needed.
Only place the semicolon onto a new line if the last expression
of the body is an if statement or an operator chain.
Instead of extracting comments from tokens with a lot of special cases, we now move them out of groups
as part of the fixup processing.
This fixes comment handling in all the remaining cases which were previously forgotten.
@piegamesde piegamesde changed the base branch from rfc101-style to master October 31, 2023 20:50
piegamesde added a commit that referenced this pull request Nov 14, 2023
As was empirically determined in #3 and piegamesde/nixpkgs#3
piegamesde added a commit that referenced this pull request Nov 15, 2023
As was empirically determined in #3 and piegamesde/nixpkgs#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants