IntelliJ Rust: Updates for 2022.3
In the 2022.3 release cycle we’ve enabled macro expansion for function-like and derive macros and build script evaluation by default.
We’ve implemented code insight features like the intention action preview, among others. The Run/debug section includes various improvements, and we’ve changed how types are rendered in the Debug window.
Additionally, there are a number of performance enhancements.
Function-like and derive macros are now expanded by default.
Items generated by procedural macros get syntax highlighting, completion, the Show Macro Expansion popup, and other features that were already available for items generated by declarative macros. Generated items are suggested in code completion and considered when using other code insight features.
That attribute macros expansion is still disabled by default. If you want to try it out, enable the
org.rust.macros.proc.attr experimental feature.
Also, we fixed procedural macros expansion on the nightly Rust toolchain.
You can read more about macros and how they are supported in IntelliJ Rust in this blog post.
Build script evaluation
We’ve enabled build script evaluation by default.
IntelliJ Rust now builds and executes all build scripts in the project – including build scripts in external dependencies – every time the project model is loaded.
A typical use case for this feature is to generate code using a build script and include it via
If you want to know more about build scripts and how to work with them in IntelliJ Rust, please refer to this blog post.
Support for intra-doc links
Code completion and other code insight features now work for intra-doc links. Some minor cases are not yet supported.
let_chains – a feature that extends
if let and
while let expressions with chaining – is now supported in IntelliJ Rust.
Intention action preview
A preview for intentions and quick-fixes is now supported. This feature is turned on by default in all JetBrains IDEs in v2022.3, and now it’s available for Rust.
Please note that some intentions and quick-fixes don’t currently have a preview. See this issue for details.
Rename items expanded from macros
The Rename refactoring now works for items expanded from macros.
Improved completion and auto-import for procedural macros
We’ve improved completion for procedural macros inside attributes and added support for auto-importing them.
Auto-import and completion now also work for custom derive macros.
Inline type alias refactoring
There is now the Inline refactoring for type aliases.
Completion for stdlib items inside scratches
Items from the standard library are now resolved in standalone files (files that don’t belong to any Cargo project), scratches, and injected Rust code. You can get highlighting, completion, and other code insight features for them.
Run doc tests from the gutter
The functionality for running documentation tests is now the same as for normal tests. For instance, you can run doc tests by pressing on the green arrow in the gutter.
Show size and contents of slices
We’ve added GDB/LLDB pretty-printers, and you can see the contents and size of Rust slices in the Debug window.
Render range types
We’ve added summary pretty-printers for range types (e.g.
core::ops::range::Range) to improve their rendering in the Debug window.
Improved rendering of type names in the debugger on Windows
We’ve changed how type names are rendered in the debugger on Windows.
Now the Rust type names that contain MSVC-specific wrappers are rendered in the Rust way.
tuple$<Foo, ref$<Bar>> is replaced by
This feature is enabled by default. To disable it, uncheck the Decorate MSVC type names checkbox in Settings | Build, Execution, Deployment | Debugger | Data Views | Rust settings.
We’ve enabled native Rust support for the MSVC LLDB debugger on Windows.
Native Rust support currently improves several things, the most visible of which is that the Rust primitive type names are displayed properly (e.g.
u64 instead of
unsigned long long).
In this release cycle, we’ve implemented a number of performance enhancements to speed up name resolution and type inference. This resulted in improved performance for most code insight features, as they depend on name resolution and type inference. Code highlighting and completion benefited the most from these changes.
In some cases, highlighting may be twice as fast as before when analyzing a new file. We also made our cache system smarter, meaning highlighting may be three times faster than before when you make changes outside of functions.
The improvement should be particularly noticeable in files where nested paths like
Foo<Foo<Foo<Foo<...>>>> are used. For example, usage of the
typenum crate leads to large nested types, which are resolved much faster with the recent changes.
As always, a big “thank you” goes to the external contributors who helped us in this release cycle:
That’s it for the most recent updates in the IntelliJ Rust plugin! Tell us what you think about our new features by writing a comment here, pinging us on Twitter, or filing an issue in the plugin’s issue tracker. Thank you!
Your Rust team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!