From 4d5cfd72295f336a91294f566baed32137ef3ed4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Sep 2018 13:55:47 +0300 Subject: prefer lifetimes in extend selection --- crates/ra_editor/src/extend_selection.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/ra_editor/src/extend_selection.rs b/crates/ra_editor/src/extend_selection.rs index 5fd1ca4fc..dc914a26a 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>"] + ); + } } -- cgit v1.2.3