11193: feat: Add config to replace specific proc-macros with dummy expanders r=Veykril a=Veykril
With this one can specify proc-macros from crates to expand into their input as a (temporary) workaround for the current completion problems with some of the bigger attribute proc-macros like `async_trait`.
This could've been done by just not expanding these macros, but that would require fiddling with nameres. I felt like this approach was simpler to pull off while also keeping the behaviour of the attributes/proc-macro in that they still expand instead of being dead syntax to us.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11052
Usage(`async_trait` as example):
```jsonc
"rust-analyzer.procMacro.dummies": {
"async-trait": [ // crate name(as per its cargo.toml definition, not the dependency name)
"async_trait" // exported proc-macro name
]
},
```
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11211: fix: Fix parsing of `#[derive]` paths r=jonas-schievink a=jonas-schievink
Currently this code produces an empty derive path for every `,`, which makes the IDE layer resolve derive paths to the wrong derive macro in the list. Skip `,`s to fix that. (nameres just ignored them, so it didn't cause problems there)
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11209: minor: Use`const _` instead of `mod __` r=jonas-schievink a=jonas-schievink
We now handle it correctly
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11207: Always put a space after impl in macro pretty-printing r=Veykril a=jplatte
… regardless of whether the next symbol is punctuation or not.
Followup to #11200.
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
11204: fix: `replace_qualified_name_with_use` does not use full item path for replacements r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11195: Correctly pass through reference modifiers when extracting a variable r=Veykril a=Vannevelj
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10034
This will parse the field expression and look at whether it is marked `&` or `&mut` and include a modifier if appropriate. The original issue only mentions `&mut params` but I've found that this issue also occurs for `&mut locals` as well as `¶ms` and `&locals` so I've also added tests for them.
I'd definitely be interested in hearing where I can make my code more idiomatic for Rust.
11202: fix: Fix `apply_demorgan` assist hanging for certain binary expressions r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10963
bors r+
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11201: fix: Fix completions not considering ancestor items for attribute search r=Veykril a=Veykril
Turns out we never filled the `CompletionContext` with the attribute expansion of attributed impls and traits when typing in the assoc items, as we were only considering the assoc item to have an attribute to expand.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11190: fix(completions): improve fn_param r=dbofmmbt a=dbofmmbt
- insert commas around when necessary
- only suggest `self` completions when param list is empty
- stop suggesting completions for identifiers which are already on the param list
Closes#11085
Co-authored-by: Eduardo Canellas <eduardocanellas98@gmail.com>
- insert commas around when necessary
- only suggest `self` completions when param list is empty
- stop suggesting completions for identifiers which are already on the param list