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.
Creating new project from within IDE is not supported yet, so you have to invoke
cargo new my_project
from the command line and then open my_project
directory.
After you have installed the plugin into IntelliJ IDEA you can import a project from source (if you use other IDE, see these instructions). You can import a project form the welcome screen:
Select the directory with the project.
Use "from existing sources" import.
Click throught the wizard steps and select a Rust toolchain:
Instead of importing, you can also simply open a project.
Select the directory with the project. Open any Rust file and configure toolchain:
Wait until Cargo downloads all project dependencies. To check that everything is
working, try Goto Symbol (Ctrl+Alt+Shift+N
) and type something. Note that
dependencies are present under external libraries. Goto Symbol should also
work for items from the external crates.
To execute Cargo tasks from within the IDE, you need to set up a Run
Configuration.
Edit configurations (Alt+Shift+F10
) and add a "Cargo command" config. Be
sure to click the green plus sign, and not the "Defaults" :) You can also
use Alt+Insert
shortcut here.
Fill in the name of a command and additional arguments.
You should be able to compile and Run (Shift+f10
) your application from the IDE now:
You can change toolchain in the settings (Ctrl+Alt+S
), under Languages & Frameworks > Rust
tab. We need Cargo from at least 1.8.0 release.
Plugin automatically watches Cargo.toml
for changes and communicates with
Cargo to learn about project structure and dependencies. If you disable this
behavior, or if you want to force a project update, you can use Refresh Cargo
project action.
In general, plugin updates should go smoothly. Though, if you experience some weird behaviour, reimport your project (using Refresh Cargo project action) or/and rebuild indices (using Invalidate caches/Restart action), prior to reporting bugs.
Check out features for some neat tricks!