Skip to content

Commit

Permalink
Auto merge of #12475 - Veykril:trait-impl-completion, r=Veykril
Browse files Browse the repository at this point in the history
fix: Fix trait impl completions using wrong insert position

Fixes #12474
  • Loading branch information
bors committed Jun 5, 2022
2 parents 995a17f + 0be31d9 commit ad6810e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion crates/ide-completion/src/completions/item_list/trait_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?,
)),
Expand Down Expand Up @@ -688,6 +688,27 @@ trait Test {
type SomeType;
}
impl Test for () {
type SomeType = $0;\n\
}
",
);
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\
}
Expand Down

0 comments on commit ad6810e

Please sign in to comment.