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

Can't make it use treefmt #241

Closed
wmertens opened this issue Jul 12, 2022 · 4 comments · Fixed by #250
Closed

Can't make it use treefmt #241

wmertens opened this issue Jul 12, 2022 · 4 comments · Fixed by #250

Comments

@wmertens
Copy link

Working on dream2nix, have direnv installed and working in the shell and in other vscode projects; it uses treefmt for formatting.

I set the workspace nix.formatter to treefmt and it keeps using my previous one until I reload the window. I assume

const FORMATTER = config.formatterPath;
needs to be resolved at format time instead of at module load time.

But after reloading the window, it doesn't format at all. Passing treefmt or the full path (+reload) doesn't make a difference, vscode now says there's no formatter for nix files installed.

@austinbutler
Copy link

I can't get it to use my preferred formatter, either. I wonder if "Enable Language Server" overwrites the setting.

@jnoortheen
Copy link
Collaborator

Please check with the latest release.

@wmertens
Copy link
Author

Hmm - I used the configuration from the readme for treefmt in my workspace configuration but when I save it still uses my user setting nixpkgs-fmt. Not sure how to debug this.

@austinbutler
Copy link

Seems I was correct, if you enable the language server the formatter is ignored, and nixpkgs-fmt is used since that's hardcoded by rnix-lsp and can't be changed yet.

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 a pull request may close this issue.

3 participants