-
With NeoVim v0.11, my code isn't formatted on save any more. If I run From the lsp info screen, I see my configuration that tried to use the I'm just not sure why format on save is no longer triggering. Environmentnvim --versionNVIM v0.11.0
Build type: Release
LuaJIT 2.1.1741730670
Run "nvim -V1 -v" for more info rust-analyzer --versionrust-analyzer 0.3.2362-standalone (fb133c8c80 2025-03-29) .rustfmt.tomledition = "2021"
fn_params_layout = "Vertical"
tab_spaces = 2
reorder_imports = true
reorder_modules = true
control_brace_style = "ClosingNextLine"
normalize_comments = true
normalize_doc_attributes = true
group_imports = "StdExternalCrate"
imports_granularity = "Module" LspConfigvim.lsp.config('rust-analyzer', {
settings = {
['rust-analyzer'] = {
checkOnSave = true,
formatOnSave = true,
rustfmt = {
extraArgs = { '+nightly', '--unstable-features' },
},
},
},
}) LspInfo- LSP log level : DEBUG
- WARNING Log level DEBUG will cause degraded performance and high disk usage
- Log path: /Users//********/.local/state/nvim/lsp.log
- Log size: 584 KB
vim.lsp: Active Clients ~
- rust-analyzer (id: 1)
- Version: 0.3.2362-standalone (fb133c8c80 2025-03-29)
- Root directory: ~/work/gitlab.*********.*****/shared/clean
- Command: { "/Users/********/.local/share/nvim/mason/bin/rust-analyzer", "--log-file", "/var/folders/l_/69sddwcd7rb9t2_gn7shtktm0000gn/T/nvim.mdelaney/xkI46G/4-rust-analyzer.log" }
- Settings: {
["rust-analyzer"] = {
checkOnSave = true,
files = {
watcher = "server"
},
formatOnSave = true,
rustfmt = {
extraArgs = { "+nightly", "--unstable-features" }
}
}
}
- Attached buffers: 2
vim.lsp: Enabled Configurations ~
vim.lsp: File Watcher ~
- file watching "(workspace/didChangeWatchedFiles)" disabled on all clients
vim.lsp: Position Encodings ~
- No buffers contain mixed position encodings
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I have no idea about neovim, but can you see logs from the server? Here's a setup that should work across all clients: set the environment variables |
Beta Was this translation helpful? Give feedback.
-
I don't know why vim.g.rustfmt_autosave = 1 |
Beta Was this translation helpful? Give feedback.
I don't know why
formatOnSave
not works in Neovim. But Neovim provide Ft_rust g:rustfmt_autosave.