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

Formatter #23

Open
JojOatXGME opened this issue Dec 27, 2020 · 3 comments · Fixed by #80
Open

Formatter #23

JojOatXGME opened this issue Dec 27, 2020 · 3 comments · Fixed by #80

Comments

@JojOatXGME
Copy link
Contributor

JojOatXGME commented Dec 27, 2020

It would be nice to have a basic formatter which manages indentation.

EDIT: Some reference: https://nixos.org/manual/nixpkgs/stable/#sec-syntax

@JojOatXGME JojOatXGME changed the title Basic Formatter Formatter Dec 27, 2020
@r-k-b
Copy link

r-k-b commented Dec 29, 2020

In the meantime, hooking up nixfmt with a File Watcher works reasonably well:
image

@JojOatXGME
Copy link
Contributor Author

Coming soon with the next release, there will be a new option in the settings which can be used to integrate nixpkgs-fmt and potentially other formatters. Thanks goes to @cottand.

Screenshot of the settings menu for external formatter

I think it would still be nice to have a very basic built-in formatter, which can at least handle the indentation in lists, attribute sets and let expressions. I will therefore keep this ticket open.

@JojOatXGME JojOatXGME reopened this Jun 8, 2024
@TheArcaneBrony
Copy link

Can confirm this feature works, personally using nixfmt-rfc-style with the following command: nix --extra-experimental-features "nix-command flakes" run nixpkgs#nixfmt-rfc-style -- -w 240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants