Before this PR, SourceChange used a bool and CompletionItem used an enum
to signify if edit is a snippet. It makes sense to use the same pattern
in both cases. `bool` feels simpler, as there's only one consumer of
this API, and all producers are encapsulated anyway (we check the
capability at the production site).
One source completion can produce up to two lsp completions.
Additionally, `preselct` and `sort_text` are global properties of the
whole set of completions, so the right granularity here is to convert
many completions.
As a side-benefit, we no loger allocate intermediate vec.
Moving tests to `rust-analyzer` crate allows removing walkdir dependency
from `xtask`. It does seem more reasonable to keep tidy tests outside of
the "build system" and closer to other integration tests.
9479: `replace_qualified_name_with_use` insert qualified import paths r=Veykril a=Veykril
Also prevents the assist from triggering on associated items.
Fixes#9472.
This PR gets rid of a lot of tests that only really test the `insert_use` infra which already has its own tests, so these tests are of no use.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
* Keep codegen adjacent to the relevant crates.
* Remove codgen deps from xtask, speeding-up from-source installation.
This regresses the release process a bit, as it now needs to run the
tests (and, by extension, compile the code).
9465: feat: `replace_match_with_if_let` works on more 2-arm matches r=Veykril a=Veykril
Now it works on pretty much on all 2-arm matches where only up to 1 arm binds a name instead of requiring either a sad or wildcard pattern to be present.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9462: minor: Print runnable kind on assertion failure for better debuggability r=Veykril a=Veykril
We are somehow hitting this when looking at `crates\ide_db\src\lib.rs` and I don't see how.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9461: fix: Fix incorrect guard for NameRefClass attribute resolution r=Veykril a=Veykril
This is what happens when you forget to write a test
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9455: feat: Handle not let if expressions in replace_if_let_with_match r=Veykril a=Veykril
Transforms bare `if cond {}` into `_ if cond` guard patterns in the match as long as at least one `if let` is in the if chain, otherwise the assist wont be applicable.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9454: feat: Empower `replace_if_let_with_match` r=Veykril a=Veykril
Now instead of only working on `if let ... {} else {}` if expressions it now works on all of them where the condition expression is the same text-wise.
This includes if let expressions without an else block, in which case a simple `_ => ()` will be generated in the resulting match but also in more complex cases where multiple `if let` expressions are chained.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>