|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "IntelliJ Rust Changelog #184" |
| 4 | +date: 2022-12-05 13:00:00 +0300 |
| 5 | +--- |
| 6 | + |
| 7 | + |
| 8 | +## Update on Procedural Macros Support |
| 9 | + |
| 10 | +We finally [enabled](https://github.com/intellij-rust/intellij-rust/pull/9729) [function-like](https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros) and [derive](https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros) procedural macro expansion by default 🎉 |
| 11 | + |
| 12 | + |
| 13 | +Now the plugin provides them with syntax highlighting, completion, the [Show Macro Expansion](https://plugins.jetbrains.com/plugin/8182-rust/docs/rust-code-reference-info.html#macro-exansion) popup, and other features already available for declarative macros. Generated items are now suggested in code completion and considered in other code insight features: |
| 14 | + |
| 15 | +<img src="/assets/posts/changelog-184/derive_proc_macro.png" width="700px"/> |
| 16 | + |
| 17 | +Note that [attribute](https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros) procedural macro expansion is still disabled by default. If you want to try out, enable `org.rust.macros.proc.attr` [experimental feature](https://plugins.jetbrains.com/plugin/8182-rust/docs/rust-faq.html#experimental-features). |
| 18 | + |
| 19 | +Read more about macros and how they are supported in Rust plugin in the [corresponding blog post](https://blog.jetbrains.com/rust/2022/12/05/what-every-rust-developer-should-know-about-macro-support-in-ides/) |
| 20 | + |
| 21 | +## New Features |
| 22 | + |
| 23 | +* [#4768] Show [coerced](https://doc.rust-lang.org/reference/type-coercions.html) types via `View | Type Info` action (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>) |
| 24 | + |
| 25 | + <img src="/assets/posts/changelog-184/type_info.png" width="350px"/> |
| 26 | + |
| 27 | +* [#9686] Support short [intra-doc links](https://doc.rust-lang.org/rustdoc/write-documentation/linking-to-items-by-name.html) (in the `[link]` format) |
| 28 | + |
| 29 | +* [#9808] Parse half-open [range patterns](https://doc.rust-lang.org/reference/patterns.html#range-patterns) |
| 30 | + |
| 31 | +* [#9760] Notify users about changes in the crate roots of procedural macro libraries to reload the project model. Otherwise, the plugin won't be able to expand procedural macro calls properly |
| 32 | + |
| 33 | +* [#9711] Experimentally set `RUST_IDE_PROC_MACRO_COMPLETION` and `RUST_IDE_PROC_MACRO_COMPLETION_DUMMY_IDENTIFIER` environment variables for procedural macro when invoking them during completion. The idea is that authors of procedural macros could use these variables and based on them change the behavior of the macro to provide a better (possibly custom) completion for IDE users. See [usage example](https://github.com/yewstack/yew/pull/2972) in `yew::html!` macro |
| 34 | + |
| 35 | +## Fixes |
| 36 | + |
| 37 | +* [#9756] Suggest `Reload project` instead of `Attach file to a module` quick-fix for the crate root files after their creation |
| 38 | + |
| 39 | +* [#9761] Fix type inference in closures on nightly Rust |
| 40 | + |
| 41 | +* [#9779] Fix false-positive errors like `Use of moved values` after invalidating caches without clearing file caches |
| 42 | + |
| 43 | +* [#9800] Fix impl search when there are multiple type aliases with the same names |
| 44 | + |
| 45 | +* [#9783] Fix [move statement up/down](https://www.jetbrains.com/idea/guide/tutorials/rearranging-code/moving-statements-around/) editor action being incorrectly disabled with some IDE configurations (by [@afetisov]) |
| 46 | + |
| 47 | +* [#9823] Fix completion inside local macro calls in 2022.3 IDE builds |
| 48 | + |
| 49 | +* [#9767] Fix navigation, highlighting, completion and other code insight features with function-like macros invoked in the pattern context |
| 50 | + |
| 51 | +* [#9762] Fix `Find usages` for variables defined by macros |
| 52 | + |
| 53 | +* [#9764] Fix handling of nested blocks expanded from local macros |
| 54 | + |
| 55 | +* [#9741] Don't offer `Un-elide lifetimes` intention when there are no input lifetimes |
| 56 | + |
| 57 | +* [#9788] Don't show `File does not belong to any known Cargo project` warning for [scratch files](https://www.jetbrains.com/help/idea/scratches.html) |
| 58 | + |
| 59 | +* [#9345] Fix nesting of renamed imports (by [@afetisov]) |
| 60 | + |
| 61 | +* [#9745] Restore `Import | Fix all 'Unresolved reference' problems in file` quick-fix option, which adds all missing unambiguous imports. Note, if you prefer missing imports to be fixed on the fly, you can enable `Add unambiguous imports on the fly` option in `Settings | Editor | General | Auto Import` settings |
| 62 | + |
| 63 | +* [#9737] Don't create separate `Undo` entries when adding unambiguous import on the fly |
| 64 | + |
| 65 | +## Internal Improvements |
| 66 | + |
| 67 | +* [#9758] Make 2022.3 platform default for development |
| 68 | + |
| 69 | +Full set of changes can be found [here](https://github.com/intellij-rust/intellij-rust/milestone/93?closed=1) |
| 70 | + |
| 71 | +[@afetisov]: https://github.com/afetisov |
| 72 | + |
| 73 | +[#4768]: https://github.com/intellij-rust/intellij-rust/pull/4768 |
| 74 | +[#9345]: https://github.com/intellij-rust/intellij-rust/pull/9345 |
| 75 | +[#9686]: https://github.com/intellij-rust/intellij-rust/pull/9686 |
| 76 | +[#9711]: https://github.com/intellij-rust/intellij-rust/pull/9711 |
| 77 | +[#9729]: https://github.com/intellij-rust/intellij-rust/pull/9729 |
| 78 | +[#9737]: https://github.com/intellij-rust/intellij-rust/pull/9737 |
| 79 | +[#9741]: https://github.com/intellij-rust/intellij-rust/pull/9741 |
| 80 | +[#9745]: https://github.com/intellij-rust/intellij-rust/pull/9745 |
| 81 | +[#9756]: https://github.com/intellij-rust/intellij-rust/pull/9756 |
| 82 | +[#9758]: https://github.com/intellij-rust/intellij-rust/pull/9758 |
| 83 | +[#9760]: https://github.com/intellij-rust/intellij-rust/pull/9760 |
| 84 | +[#9761]: https://github.com/intellij-rust/intellij-rust/pull/9761 |
| 85 | +[#9762]: https://github.com/intellij-rust/intellij-rust/pull/9762 |
| 86 | +[#9764]: https://github.com/intellij-rust/intellij-rust/pull/9764 |
| 87 | +[#9767]: https://github.com/intellij-rust/intellij-rust/pull/9767 |
| 88 | +[#9779]: https://github.com/intellij-rust/intellij-rust/pull/9779 |
| 89 | +[#9783]: https://github.com/intellij-rust/intellij-rust/pull/9783 |
| 90 | +[#9788]: https://github.com/intellij-rust/intellij-rust/pull/9788 |
| 91 | +[#9800]: https://github.com/intellij-rust/intellij-rust/pull/9800 |
| 92 | +[#9808]: https://github.com/intellij-rust/intellij-rust/pull/9808 |
| 93 | +[#9823]: https://github.com/intellij-rust/intellij-rust/pull/9823 |
0 commit comments