rust-analyzer/crates/ide-assists/src
bors 336608aa92 Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril
Add action to expand a declarative macro once, inline. Fixes #13598

This commit adds a new r-a method, `expandMacroInline`, which expands the macro that's currently selected. See  #13598 for the most applicable issue; though I suspect it'll resolve part of #5949 and make #11888 significantly easier).

The macro works like this:

![rust-analyser-feature](https://user-images.githubusercontent.com/10906982/208813167-3123e379-8fd5-4206-a4f4-5af1129565f9.gif)

I have 2 questions before this PR can be merged:

1. **Should we rustfmt the output?** The advantage of doing this is neater code. The disadvantages are we'd have to format the whole expr/stmt/block (since there's no point just formatting one part, especially over multiple lines), and maybe it moves the code around more in weird ways. My suggestion here is to start off by not doing any formatting; and if it appears useful we can decide to do formatting in a later release.
2.   **Is it worth solving the `$crate` hygiene issue now?** -- I think this PR is usable as of right now for some use-cases; but it is annoying that many common macros (i.e. `println!()`, `format!()`) can't be expanded further unless the user guesses the correct `$crate` value. The trouble with solving that issue is that I think it's complicated and imperfect. If we do solve it; we'd also need to either change the existing `expandMacro`/`expandMacroInline` commands; provide some option to allow/disallow `$crate` expanding; or come to some other compromise.
2023-01-09 14:24:41 +00:00
..
handlers Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril 2023-01-09 14:24:41 +00:00
tests Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril 2023-01-09 14:24:41 +00:00
utils use pointer args 2023-01-02 14:52:32 +00:00
assist_config.rs feat: add config for inserting must_use in generate_enum_as_method 2022-10-24 13:18:24 +05:30
assist_context.rs Import serde derives on converting json to struct 2022-08-06 20:12:21 +04:30
lib.rs Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril 2023-01-09 14:24:41 +00:00
tests.rs Inline all format arguments where possible 2022-12-24 14:36:10 -05:00
utils.rs Auto merge of #13763 - rami3l:fix/gen-partial-eq-generic, r=Veykril 2023-01-09 13:02:09 +00:00