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>
9771: Give better error message when the rust-analyzer binary path was set in the user's config but the binary is invalid r=matklad a=rylev
`@yoshuawuyts` and I ran into an issue where my rust-analyzer binary path was set in my extension config (which I didn't realize), but the path set in the config was invalid (it simply wasn't on my path). Having an error message that hinted that the binary's path was explicitly set in the config would have considerably shortened the debug time.
Thanks!
Co-authored-by: Ryan Levick <me@ryanlevick.com>