9808: fix: Look for enum variants and trait assoc functions when looking for lang items r=matklad a=Veykril
Examples for lang enum variants are the `Option` variants.
Assoc trait functions aren't being seen since they aren't declared in the direct module scope.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9806: Add proc_macro crate for the 1.56 ABI r=lnicola a=alexjg
I've copied the latest proc macro source from Rust nightly and modified it to compile on `stable`. This fixes#9795 . Almost everything here is uninteresting copy and paste, the interesting stuff is in `crates/proc_macro_srv/src/abis/mod.rs`. I've left the 1.55 ABI implementation in for now. We did discuss only supporting one nightly ABI so we may want to remove 1.55. That will break code which is pinned to older nightly releases but that seems acceptable to me, what do people think?
Co-authored-by: Alex Good <alex@memoryandthought.me>
9785: feature: Add completion for struct literals in which all fields are visible. r=Veykril a=Afourcat
This PR adds a new completion for struct literal.
It Implements the feature discussed in the issue #9610.
![RAExample3](https://user-images.githubusercontent.com/35599359/128211142-116361e9-7a69-425f-83ea-473c6ea47b26.gif)
This PR introduce a repetition in the source files `crates/ide_completion/render/pattern.rs` and `crates/ide_completion/render/struct_literal.rs` that may be fix in another PR.
Co-authored-by: Alexandre Fourcat <afourcat@gmail.com>
9788: fix: extract_function does not move locals defined outside of loops r=Veykril a=Veykril
Fixes#8234
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Fix ide_completion tests.
Move 'complete_record_literal' call to the main completion function.
Fix a rendering bug when snippet not available.
Checks if an expression is expected before adding completion for struct literal.
Move 'completion struct literal with private field' test to 'expressions.rs' test file.
Update 'expect' tests with new check in 'complete record literal'.
9786: fix: Fix detection of macro file in inactive-code diag r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9753
`HirFileId::expansion_info` can return `None` for builtin macros or if there's an error in the macro call or definition, so add a `HirFileId::is_macro` method that checks the right thing.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
9734: semantic highlighting: add reference hlmod r=matklad a=jhgg
This PR adds the "reference" highlight modifier!
I basically went around and looked for `HlMod::Mutable` to find the callsites to add a reference. I think these all make sense!
Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
9773: internal: Improve `extract_function` assist r=Veykril a=Veykril
- fix: It doesn't try to overwrite parts of selected comments any longer
- fix: It doesn't wrap tail expressions and return types in a result or option unnecessarily
- feat?: It now adds a `const` modifier to the created function if extract somethings from a const context
Fixes#7840
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>