12/3/2023 0 Comments Code prettierThe intention is to save work for the compiler down the line, unfortunately it also means that rustc sometimes fails to parse syntactically correct code. There's also that rustc has many lint-like checks within the parser. Rustc is strict and unforgiving as it always assumes code is at its "final version", thus every slight deviation from the accepted syntax crashes the parser. Unfortunately Rustfmt cannot implement those features by design. Why not just add syntax autocorrection to rustfmt instead?.missing semicolons, blocks, parentheses)įormatting succeeds and fixes 7 syntax errors.Ĭomplete config with default values: #. Speed up the day-to-day - Prettier auto-fixes common syntax errors (e.g.There when you need it the most - Prettier can format code that won't compile (e.g.Beautiful, uniform and consistent - Prettier is strongly opinionated, with no style options.No matter how incomplete or broken the code you're working on is, with the Prettier Editor Extension you can always just press the Format Document key binding and *poof*, the code snaps right into place. What usually happens once people start using Prettier is that they realize how much time and mental energy they actually spend formatting their code. ![]() Repository: GitHub - jinxdash/prettier-plugin-rust: Prettier Rust is an opinionated code formatter that autocorrects bad syntax. Visit the repository to see other install options (Core extension, as a plugin, in the CLI, as a crate.) Quickstart: Search VSCode extension: Prettier - Code formatter (Rust)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |