IntelliJ Rust: Updates for 2021.1
This is the first entry we are publishing in a dedicated blog for IntelliJ Rust! Previously hosted on the CLion blog, our articles were tied closely to that particular IDE. From now on, we’ll be describing the plugin’s news and features with regard to all the IDEs it’s compatible with.
Have you already explored the documentation we released a while ago? If not, we encourage you to check it out! It describes the plugin in full detail and also gives some general IDE-related info. Our documentation system is still in active development on both the frontend and the content edge, so your feedback is very welcome! Please share your experience in the comments below or submit an issue in our tracker (we are working on a more convenient solution for collecting feedback on the docs).
Now let’s dive into the updates that have landed in the plugin in this release cycle.
- Debugging in more IDEs
- Structured view in the Build tool window
- Improvements in refactorings
- Editor updates
- Enhancements in conditional compilation support
- Experimental name resolution engine: fixes, features, and optimizations
- Initial support for procedural macros
Debugging in more IDEs
Previously, debugging for your Rust code was available in CLion and IntelliJ IDEA Ultimate only. Starting from the 2021.1 version of the IDEs, it also works in GoLand and PyCharm Pro. It is implemented similarly to that in IntelliJ IDEA Ultimate and requires the Native Debugging Support plugin and works with LLDB.
Structured view in the Build tool window
The structured view for the compiler’s output inside the Build tool window is now enabled by default. The dedicated tab, Build Output, opens up automatically when you call any Cargo command with a building step, such as
check, and others.
By default, it shows warnings and failures for a build. Use the ‘eye’ button in the left-hand pane if you prefer successful steps to be displayed as well:
This structured view works with Cargo versions 1.48.0 and later. If you are using an earlier Cargo version, the compiler’s output will be logged in plain text as before.
Improvements in refactorings
If you are working in a JetBrains IDE with code in languages other than Rust, you might be accustomed to the Change Signature refactoring. Now it works for Rust too!
This refactoring can help you quickly change the name and return type of a function, modify the list of the parameters and set the default ones, and also add the
Currently, the implementation of Change Signature for Rust lacks the suggestions available for other languages. We plan to add this functionality shortly.
Now you don’t have to call Rename manually when changing a code element like struct, function, or local variable. Just start typing a new name, and the refactoring will suggest a list of hints right away:
All Rust-related actions are now grouped under a separate node in the Tools section of the main menu and in context menus all over the IDE:
A new action, Share in Playground, is a timesaver when you need to share a piece of code on Rust Playground. Make a selection, call Tools | Rust | Share in Playground, and IJ Rust will post your code there for you:
Another notable update in the editor is the new intention for making an item public or private:
Enhancements in conditional compilation support
In this release cycle, we added the Find Usages functionality for Cargo features to help you easily navigate between the usages of a particular feature across the entire code base:
Completion now works for the
feature argument, as well as the features’ values, in both
cfg_attr support, IJ Rust now takes the nested attributes inside
cfg_attr into account during name resolution and code analysis. This applies to the cases like
cfg_attr(..., derive(...)) or
Experimental name resolution engine: fixes, features, and optimizations
In the previous blog post, we announced a redesign of the plugin’s name resolution engine. The new engine is still in the experimental stage and is disabled by default. To give it a try, enable the Use experimental name resolution engine checkbox in Settings / Preferences | Languages & Frameworks | Rust.
Over the last months, the new engine has received a lot of fixes and updates. Here are a few of the key ones:
- The new engine is now capable of resolving derive procedural macros (learn more on procedural macros support below).
It finds all possible
implblocks for a type alias. Previously, for performance reasons, they were processed only when the number of aliases for the corresponding type didn’t exceed 10. Now the crates that heavily use type aliases, such as nalgebra or winapi, can be resolved properly.
It supports file-level
- It fully supports textual scoping when resolving macros.
It properly resolves multi-segment macro paths and macro calls inside files included by
On top of that, the engine’s memory consumption has been reduced significantly, along with an overall speedup of the algorithm. This is especially noticeable in large Rust modules.
Initial support for procedural macros
IntelliJ Rust is now capable of expanding function-like procedural macros, providing them with syntax highlighting, completion, the Show Macro Expansion popup, and other features already available for declarative macros.
The current implementation is in its early stages, so please mind possible issues and unexpected behaviour in some cases. To try it out, call Help | Find Action (
Ctrl+Shift+A on Linux/Windows,
⇧⌘A on macOS), search for Experimental Features, and enable org.rust.cargo.evaluate.build.scripts and org.rust.macros.proc:
Make sure to reload the project before checking out your code.
We would like to continue the tradition of giving thanks to the external contributors who have helped us in this release cycle. Thank you for dedicating your time and effort to IntelliJ Rust!
That’s it for the most recent updates in the IJ Rust plugin. Thank you for reading and stay tuned!
Your Rust team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
Introducing RustRover – A Standalone Rust IDE by JetBrains
“When will there be a Rust IDE?” We get this question from our users quite frequently, and today we’re happy to announce that the day has arrived. Please welcome RustRover, our standalone IDE for Rust. As many of you are aware, we’ve worked for years to bring support for Rust functionality as …
New in IntelliJ Rust for 2023.1 (Part 2)
In the first part of this “What’s New” series, we only saw the tip of the iceberg – various feature bits that the Rust plugin developers managed to implement during the release cycle.Now we’re going to show you the rest of the iceberg. Let’s dig in and look at all the new ways the plugin can now ana…
New in IntelliJ Rust for 2023.1 (Part 1)
The time has come to outline the state of the IntelliJ-based IDEs’ Rust plugin as of the 2023.1 release. In the following paragraphs, we’ll delve into the novelties, improvements, and refinements that our team has delivered throughout the release cycle. Follow the post to learn more about the sig…