diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2022-06-05 20:29:36 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2022-06-05 20:29:36 +0200 |
| commit | 0be31d945e380471c0183884f57af85b812d6497 (patch) | |
| tree | de347859e50d214f39f36278d95ceae01c70a562 | |
| parent | 995a17fbd9f7cdedfdafec946b1d9e44eff448b4 (diff) | |
| download | rust-0be31d945e380471c0183884f57af85b812d6497.tar.gz rust-0be31d945e380471c0183884f57af85b812d6497.zip | |
fix: Fix trait impl completions using wrong insert position
| -rw-r--r-- | crates/ide-completion/src/completions/item_list/trait_impl.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/crates/ide-completion/src/completions/item_list/trait_impl.rs b/crates/ide-completion/src/completions/item_list/trait_impl.rs index 8a2bbae73f4..56f656f4794 100644 --- a/crates/ide-completion/src/completions/item_list/trait_impl.rs +++ b/crates/ide-completion/src/completions/item_list/trait_impl.rs @@ -118,7 +118,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, Text ImplCompletionKind::All, match nameref { Some(name) => name.syntax().text_range(), - None => TextRange::empty(ctx.position.offset), + None => ctx.source_range(), }, ctx.impl_def.clone()?, )), @@ -693,6 +693,27 @@ impl Test for () { } ", ); + check_edit( + "type SomeType", + r#" +trait Test { + type SomeType; +} + +impl Test for () { + type$0 +} +"#, + " +trait Test { + type SomeType; +} + +impl Test for () { + type SomeType = $0;\n\ +} +", + ); } #[test] |
