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

Formatting (with alejandra) not working anymore #123

Open
sbatial opened this issue Feb 13, 2024 · 1 comment
Open

Formatting (with alejandra) not working anymore #123

sbatial opened this issue Feb 13, 2024 · 1 comment
Labels
C-support Catagory: support questions

Comments

@sbatial
Copy link

sbatial commented Feb 13, 2024

I could not figure out why but since recently formatting does not seem to work anymore.
When I try to manually invoke !alejandra % it works (and I have set alejandra as the formatting command as well), but using my shortcut (or invoking vim.lsp.buf.format()) does not format anything but also does not give any errors.
Neither as an instant message nor in LspLog.

The server is running, I get code-completion.

I also tried formatting in lua files which does work.

My neovim version is: v0.10.0-dev-4e59422
My nil version is the latest on nixpkgs-unstable: 2023-08-09 (I saw that there were a few commits since then so I'll try to test it with a newer version as soon as I find the time for that. It's not really a problem for now though)

@oxalica
Copy link
Owner

oxalica commented May 30, 2024

I cannot reproduce the issue on current master and alejandra works fine with LSP formatting command.

!alejandra %

alejandra will modify the file directly by themselves, while our configuration expects a command that processes source from stdin and print into stdout. So you are expected to use command alejandra -- in the configuration, like this:

{
  "nil": { "formatting": { "command": ["alejandra", "--"] } }
}

Please recheck that you does this as well.

@oxalica oxalica added the C-support Catagory: support questions label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Catagory: support questions
Projects
None yet
Development

No branches or pull requests

2 participants