rust/intellij.md
Josh Soref cedb7b5058
Spelling (#5753)
various spelling fixes
---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2024-01-25 18:55:23 -05:00

2.0 KiB

Running Rustfmt from IntelliJ or CLion

Installation

Configuration

Run Rustfmt on save

  • Open Rustfmt settings (File → Settings → Languages & Frameworks → Rust → Rustfmt) and enable "Run rustfmt on Save" run_rustfmt_on_save

  • IntelliJ uses autosave, so now your files will always be formatted according to rustfmt. Alternatively you can use Ctrl+S to reformat file manually

Bind shortcut to "Reformat File with Rustfmt" action

  • Open the settings window (File → Settings) and search for "reformat" keymap

  • Right-click on "Reformat File with Rustfmt" and assign a keyboard shortcut

    shortcut_window

  • Press "OK" shortcut_after

  • Done. You can now use rustfmt in an opened *.rs file with your previously specified shortcut