aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/extend_selection.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-19 13:00:04 +0000
committerGitHub <[email protected]>2020-02-19 13:00:04 +0000
commit61fdcc5ded44d4a7300b19cf946acc30367dcbd2 (patch)
treee6734888ce2c51f79f1e45b0d30fa6245f1d529d /crates/ra_ide/src/extend_selection.rs
parent624a9978e25c7c6cee7fd88afd1559f1f143fe4e (diff)
parentbcb5f1b65c1f03b0eec757fa77a8b4ca7936a5ec (diff)
Merge #3233
3233: Extend selection handles commas in tuple pats r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/extend_selection.rs')
-rw-r--r--crates/ra_ide/src/extend_selection.rs27
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#"
628fn 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} }