Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-rust

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-rust

Prettier plugin for Rust

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
594
decreased by-50.38%
Maintainers
1
Weekly downloads
 
Created
Source
Prettier Rust

Prettier Rust

GitHub license npm version GitHub Repo stars Twitter Follow

The massively popular Prettier code formatter, now with Rust support!

A formatter -- not a linter!

Prettier Rust doesn't panic on missing semicolons, in fact it AUTO-COMPLETES them!

Thanks to the specially built jinx-rust parser, Prettier is completely independent from Rust's strict validation process.
As such, it is able to format rust just like it formats typescript!

Configuration

Configure prettier by creating a .prettierrc.toml file, or any other file format listed in prettier docs.

To ignore files, list them in .prettierignore (like you would .gitignore)

API OptionCLI OptionDefaultDocs
tabWidth--tab-width4link
printWidth--print-width100link
endOfLine--end-of-line"lf"link
trailingComma--trailing-commaNot supported yet.
embeddedLanguageFormatting--embedded-language-formattingNot supported yet.

Ignoring stuff

To ignore something, add // prettier-ignore above it.

#[rustfmt::skip] and #![rustfmt::skip] are also supported (locally).

Installation

VSCode

  • Either install the standalone extension Prettier - Code formatter (Rust) or

  • use the official one which has issues loading plugins and will NOT auto-update them. Read about plugins in Prettier docs.

If you have rust-analyzer or another extension that formats rust files installed, VSCode will prompt you to choose your preferred formatter the next time you attempt to format a file. If you already had one defined, you may have to adjust your settings:

"[rust]": {
		"editor.defaultFormatter": "jinxdash.prettier-rust"
}

crate

Not available yet

npm

The plugin is published on npm as prettier-plugin-rust and can be used like any other prettier plugin.

npm install --save-dev prettier-plugin-rust

Refer to the Prettier documentation for available CLI commands.

Keywords

FAQs

Package last updated on 27 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc