8000 Preserving empty lines before a semicolon is a bit strange · Issue #298 · NixOS/nixfmt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Preserving empty lines before a semicolon is a bit strange #298

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

Open
jfly opened this issue Apr 30, 2025 · 3 comments
Open

Preserving empty lines before a semicolon is a bit strange #298

jfly opened this issue Apr 30, 2025 · 3 comments

Comments

@jfly
Copy link
Collaborator
jfly commented Apr 30, 2025

Description

Originally requested by @mightyiam in #296

Small example input

{
  a = null

  ;
}

Expected output

{
  a = null;
}

Actual output

{
  a = null

  ;
}
@MattSturgeon
Copy link

Quoting @piegamesde, this originates from the RFC:

Either way, the current behavior is by design

  • Line breaks may be added or removed, but empty lines must not be created. Single empty lines must be preserved, and consecutive empty lines must be collapsed into a single empty line.

but personally, I'd be open to a discussion re-evaluating it

Agreed.

@piegamesde
Copy link
Member

I'm curious, in which scenario would one encounter such an input? Is this something that somehow happened in the wild?

@mightyiam
Copy link
Member

It happened during my wild editing. I allow myself to copy-paste with disregard to formatting because usually format-on-save does the right thing and that's brilliant. This is one anomaly that I've had to manually format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

4 participants
0