mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
prefer lifetimes in extend selection
This commit is contained in:
parent
5901e98116
commit
4d5cfd7229
1 changed files with 13 additions and 1 deletions
|
@ -64,7 +64,7 @@ fn pick_best<'a>(l: SyntaxNodeRef<'a>, r: SyntaxNodeRef<'a>) -> SyntaxNodeRef<'a
|
|||
fn priority(n: SyntaxNodeRef) -> usize {
|
||||
match n.kind() {
|
||||
WHITESPACE => 0,
|
||||
IDENT | SELF_KW | SUPER_KW | CRATE_KW => 2,
|
||||
IDENT | SELF_KW | SUPER_KW | CRATE_KW | LIFETIME => 2,
|
||||
_ => 1,
|
||||
}
|
||||
}
|
||||
|
@ -164,4 +164,16 @@ fn main() { foo+<|>bar;}
|
|||
&["bar", "foo+bar"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extend_selection_prefer_lifetimes() {
|
||||
do_check(
|
||||
r#"fn foo<<|>'a>() {}"#,
|
||||
&["'a", "<'a>"]
|
||||
);
|
||||
do_check(
|
||||
r#"fn foo<'a<|>>() {}"#,
|
||||
&["'a", "<'a>"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue