{"library":"prettier-plugin-rust","title":"Prettier Plugin for Rust","description":"A prettier plugin for formatting Rust code, version 0.1.9. It provides Prettier-based formatting for Rust files, supporting both code that compiles and code that doesn't (e.g., missing annotations). It fixes common syntax errors like missing semicolons, blocks, and parentheses. The plugin also includes a VSCode extension. It uses the jinx-rust parser. Key differentiators vs rustfmt: ability to format incomplete code, auto-fix common errors, and integration with Prettier ecosystem. Released monthly or so; actively maintained.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install prettier-plugin-rust"],"cli":null},"imports":["import prettierPluginRust from 'prettier-plugin-rust'","Add to .prettierrc: { \"plugins\": [\"prettier-plugin-rust\"] }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const prettier = require('prettier');\nconst code = `const LEET = 1337\\nfn main() {\\n  let x = 1 + 2\\n}`;\nasync function formatRust() {\n  const result = await prettier.format(code, {\n    parser: 'rust',\n    plugins: ['./node_modules/prettier-plugin-rust'],\n    tabWidth: 4,\n    printWidth: 100,\n  });\n  console.log(result);\n}\nformatRust().catch(console.error);","lang":"javascript","description":"Demonstrates formatting Rust code using Prettier's programmatic API with the plugin. Shows parser option 'rust' and plugin path.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}