diff options
author | Aleksey Kladov <[email protected]> | 2020-02-19 12:59:19 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-19 12:59:19 +0000 |
commit | bcb5f1b65c1f03b0eec757fa77a8b4ca7936a5ec (patch) | |
tree | e6734888ce2c51f79f1e45b0d30fa6245f1d529d | |
parent | 624a9978e25c7c6cee7fd88afd1559f1f143fe4e (diff) |
Extend selection handles commas in tuple pats
-rw-r--r-- | crates/ra_ide/src/extend_selection.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 726963a33..4757d8e22 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -44,6 +44,7 @@ fn try_extend_selection( | |||
44 | ARRAY_EXPR, | 44 | ARRAY_EXPR, |
45 | TUPLE_EXPR, | 45 | TUPLE_EXPR, |
46 | TUPLE_TYPE, | 46 | TUPLE_TYPE, |
47 | TUPLE_PAT, | ||
47 | WHERE_CLAUSE, | 48 | WHERE_CLAUSE, |
48 | ]; | 49 | ]; |
49 | 50 | ||
@@ -612,6 +613,32 @@ fn main() { let var = ( | |||
612 | } | 613 | } |
613 | 614 | ||
614 | #[test] | 615 | #[test] |
616 | fn test_extend_selection_on_tuple_pat() { | ||
617 | do_check( | ||
618 | r#"fn main() { let (krate, _crate_def_map<|>, module_id) = var; }"#, | ||
619 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], | ||
620 | ); | ||
621 | // white space variations | ||
622 | do_check( | ||
623 | r#"fn main() { let (krate,_crate<|>_def_map,module_id) = var; }"#, | ||
624 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], | ||
625 | ); | ||
626 | do_check( | ||
627 | r#" | ||
628 | fn main() { let ( | ||
629 | krate, | ||
630 | _crate_def_map<|>, | ||
631 | module_id | ||
632 | ) = var; }"#, | ||
633 | &[ | ||
634 | "_crate_def_map", | ||
635 | "_crate_def_map,", | ||
636 | "(\n krate,\n _crate_def_map,\n module_id\n)", | ||
637 | ], | ||
638 | ); | ||
639 | } | ||
640 | |||
641 | #[test] | ||
615 | fn extend_selection_inside_macros() { | 642 | fn extend_selection_inside_macros() { |
616 | do_check( | 643 | do_check( |
617 | r#"macro_rules! foo { ($item:item) => {$item} } | 644 | r#"macro_rules! foo { ($item:item) => {$item} } |