diff options
author | Aleksey Kladov <[email protected]> | 2018-09-19 11:55:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-19 11:55:47 +0100 |
commit | 4d5cfd72295f336a91294f566baed32137ef3ed4 (patch) | |
tree | 016f6ff6e061bb49f1329b55ae71f4994bbc8ad3 | |
parent | 5901e9811636f0a5c5f73ef99ee574da83888a68 (diff) |
prefer lifetimes in extend selection
-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 | } |