Rust-analyzer format on paste in VS Code


I'm using VS Code and playing around with rust-analyzer settings. Right now my only relevant user settings are:

"[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer",
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"rust-analyzer.checkOnSave.command": "clippy",

While format on save works as expected, format on paste does not. Of course it is not a major problem, but it would be nice to know why that happens, or if it is a bug, to open an issue on it.

I presume vscode wants to do a range format for just the pasted code for format on paste. Rustfmt's range formatting support is unstable and is not supported by rust-analyzer. As such pasting code doesn't get formatted.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.