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

nixfmt keeps moving comments immediately after in #100

Closed
menixator opened this issue Aug 29, 2022 · 2 comments
Closed

nixfmt keeps moving comments immediately after in #100

menixator opened this issue Aug 29, 2022 · 2 comments

Comments

@menixator
Copy link

Given the expression

let  
    a = 0;
in 
# checking if a == 0
if a == 0 then 
"a is zero"
else
"a is not zero"

nixfmt outputs:

let
  a = 0;
  # checking if a == 0
in if a == 0 then "a is zero" else "a is not zero"

nixfmt moves the comment before the in which sort of makes sense for smaller comments but big blocks of comments look weird.
Is this intended behavior?

@menixator menixator changed the title Nixfmt keeps moving comments immediately after in nixfmt keeps moving comments immediately after in Aug 29, 2022
@Lucus16
Copy link
Contributor

Lucus16 commented Sep 5, 2022

Moving the comment before the in is intentional and currently the only case where comments are moved. The fact that it gets indented is not intentional and is something that will eventually be fixed once I get around to #32.

@piegamesde
Copy link
Member

The layout in #118 does occasionally move comments around, but not in this case.

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

No branches or pull requests

3 participants