diff options
Diffstat (limited to 'crates/ra_editor/src/extend_selection.rs')
-rw-r--r-- | crates/ra_editor/src/extend_selection.rs | 14 |
1 files changed, 13 insertions, 1 deletions
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 | |||
64 | fn priority(n: SyntaxNodeRef) -> usize { | 64 | fn priority(n: SyntaxNodeRef) -> usize { |
65 | match n.kind() { | 65 | match n.kind() { |
66 | WHITESPACE => 0, | 66 | WHITESPACE => 0, |
67 | IDENT | SELF_KW | SUPER_KW | CRATE_KW => 2, | 67 | IDENT | SELF_KW | SUPER_KW | CRATE_KW | LIFETIME => 2, |
68 | _ => 1, | 68 | _ => 1, |
69 | } | 69 | } |
70 | } | 70 | } |
@@ -164,4 +164,16 @@ fn main() { foo+<|>bar;} | |||
164 | &["bar", "foo+bar"] | 164 | &["bar", "foo+bar"] |
165 | ); | 165 | ); |
166 | } | 166 | } |
167 | |||
168 | #[test] | ||
169 | fn test_extend_selection_prefer_lifetimes() { | ||
170 | do_check( | ||
171 | r#"fn foo<<|>'a>() {}"#, | ||
172 | &["'a", "<'a>"] | ||
173 | ); | ||
174 | do_check( | ||
175 | r#"fn foo<'a<|>>() {}"#, | ||
176 | &["'a", "<'a>"] | ||
177 | ); | ||
178 | } | ||
167 | } | 179 | } |