Bold text denotes the names of actions you can type in the Find Action dialog (Ctrl+Shift+A or quickly press Shift twice for Find Anything). Shortcuts are given for the default Windows/Linux keymap. To learn shortcuts for your keymap consult Help > Keymap reference. Shortcut for an action is also displayed in the Find Action dialog.

Smart editor

Syntax highlighting

IntelliJ Rust, apart from basic lexer highlighting, also highlights resolved types, functions, variables (marking out mutable ones) and macros. All color schemes are customizable and we support both Default and Darcula themes out of the box.

Code formatter

Reformat Code Ctrl+Alt+L reformats current file or selection using our custom, fully functional formatter based on IntelliJ's formatting engine, though rustfmt support is WIP. You can use a Run Configuration to invoke rustfmt.

Code selection

To select a block of code place a cursor inside block and press Ctrl+W to expand it to an expression, to a line, to a logical block of code, and so on. To shrink selection press Ctrl+Shift+W as many times as needed.

Code commenting

After selecting block, you can apply a block comment (Ctrl+Shift+/) or line comment (Ctrl+/) to it. The same shortcuts will remove existing comments from selected lines too.

Code folding

Code folding, auto-insertion of braces, brackets & quotes, matching brace/bracket highlighting, etc.

On-the-fly analysisWIP

Errors are shown as you type. Among others, we catch syntax errors, missing fields/methods and unnecessary parens. We also support IntelliJ's built-in spell-checker.

Code CompletionWIP

IntelliJ Rust features built from scratch code completion, leveraging IntelliJ Platform capabilities. Ctrl+Space invokes completion. We do not plan to use racer. A decent amount of completion intelligence is already implemented, but there is definitely a lot more to do. Here are some examples of what works and what does not work (as of August 1).

Remember, if the smart completion does not work for your particular case, you can always invoke "dumb completion" via Alt+/. It merely suggests identifiers already present in the file, but works surprisingly well.

Source code navigation

There are a number of actions for efficient navigation across your project and dependencies.

Find UsagesWIP

Alt+F7 finds usages of element at caret.

Goto Declaration

Ctrl+B goes to the definition of the symbol at caret.

Goto Class

Ctrl+N search for a struct or enum by name.

Goto Symbol

Ctrl+Shift+Alt+N searches for any symbol (types, methods, functions, fields) by name. Together with Ctrl+N it is the main method to explore large projects.

Goto Super

Ctrl+U navigates to the parent module.

File Structure

Ctrl+F12, Alt+7 brings up an overview of the current file.

Code generation and refactorings

'Surround With' and Live Templates

There is a number of built in live templates and you can define your own. Different live templates are available in different contexts. Use Ctrl+J to list templates available in context.

  • p, pd, ppd - println! value with {}, debug {:?} and pretty debug {:#?} formats.

  • a, ae - assert! / assert_eq!

  • tfn - test function boilerplate

    tmod - test module boilerplate

  • f, pf - (pub) field name and type, applicable inside struct definitions.

  • loop, while, for templates. You can select a fragment of code and press Ctrl+Alt+J to invoke Surround With Live Template action.

RefactoringsWIP

Expand module: invoke this refactoring inside foo.rs file to get foo/mod.rs. Also available as a quick fix for unresolved module declaration.

Intentions

Intentions and quick fixes are micro refactorings automatically available depending on context. If some intentions are available, a light bulb icon appears in the editor. You can use Alt+Enter to invoke a quick fix.

Contract module: the opposite of Expand Module refactoring. Available only if there are no child modules.

Create module file: if you have mod foo;, but no foo.rs this quick fix will create the missing file.

Extract inline module: move mod foo { ... } to a separate file.

Add derive clause: adds #[derive(..)] attribute to structs and enums.

Remove/Add curly braces: toggles between use foo::{bar} and use foo::bar.

Add missing fields: a handy way to fill out the struct literal template.

Implement methods: quickly scafold an impl.

Documentation

Highlighting

IntelliJ Rust highlights important parts of documentation comments, so they never look so bland.

Quick documentation

Ctrl+Q shows docs for the symbol at caret.

Running

Configurations

Built-in Cargo Command run configuration allows to build, test and run Rust code.

Context aware

You can use Ctrl+Shift+F10 shortcut to run a main or a test function. Alternativelly, you can use the icon in the gutter area.

Synergy

You can combine Ctrl+Alt+Shift+N with Ctrl+Shift+F10 to find and execute a test without switching between code and tests.