mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
fix: Fix trait impl completions using wrong insert position
This commit is contained in:
parent
995a17fbd9
commit
0be31d945e
1 changed files with 22 additions and 1 deletions
|
@ -118,7 +118,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, Text
|
||||||
ImplCompletionKind::All,
|
ImplCompletionKind::All,
|
||||||
match nameref {
|
match nameref {
|
||||||
Some(name) => name.syntax().text_range(),
|
Some(name) => name.syntax().text_range(),
|
||||||
None => TextRange::empty(ctx.position.offset),
|
None => ctx.source_range(),
|
||||||
},
|
},
|
||||||
ctx.impl_def.clone()?,
|
ctx.impl_def.clone()?,
|
||||||
)),
|
)),
|
||||||
|
@ -688,6 +688,27 @@ trait Test {
|
||||||
type SomeType;
|
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 () {
|
impl Test for () {
|
||||||
type SomeType = $0;\n\
|
type SomeType = $0;\n\
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue