diff --git a/crates/ra_editor/src/extend_selection.rs b/crates/ra_editor/src/extend_selection.rs index 5fd1ca4fc65..dc914a26ada 100644 --- a/crates/ra_editor/src/extend_selection.rs +++ b/crates/ra_editor/src/extend_selection.rs @@ -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>"] + ); + } }