Reputation: 1316
I installed the Rust Prettier extension: https://github.com/jinxdash/prettier-plugin-rust but it is not formatting my rust files when I save.
I see this icon in VS Code in the Status Bar at the bottom-right indicating that Prettier is disabled when I click on a rust file:
This is usually what it looks like for me like if I click on a JavaScript file:
I also ran npm install --global prettier-plugin-rust prettier
per the docs.
This is just showing the VS Code extension I've installed:
From VS Code Output
["INFO" - 10:35:08 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 10:35:08 PM] Extension Version: 9.10.3.
What's going on? Why is Prettier disabled on Rust files?
Could Rust files need to be enabled in the VS Code or Prettier settings?
Please let me know if I am missing any relevant information in the comments, thank you.
Upvotes: 1
Views: 2586
Reputation: 931
Add this to settings.json
{
"[rust]": {
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "jinxdash.prettier-rust"
}
}
Upvotes: 5