From bcb5f1b65c1f03b0eec757fa77a8b4ca7936a5ec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Feb 2020 13:59:19 +0100 Subject: Extend selection handles commas in tuple pats --- crates/ra_ide/src/extend_selection.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crates/ra_ide/src/extend_selection.rs') 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( ARRAY_EXPR, TUPLE_EXPR, TUPLE_TYPE, + TUPLE_PAT, WHERE_CLAUSE, ]; @@ -611,6 +612,32 @@ fn main() { let var = ( ); } + #[test] + fn test_extend_selection_on_tuple_pat() { + do_check( + r#"fn main() { let (krate, _crate_def_map<|>, module_id) = var; }"#, + &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], + ); + // white space variations + do_check( + r#"fn main() { let (krate,_crate<|>_def_map,module_id) = var; }"#, + &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], + ); + do_check( + r#" +fn main() { let ( + krate, + _crate_def_map<|>, + module_id +) = var; }"#, + &[ + "_crate_def_map", + "_crate_def_map,", + "(\n krate,\n _crate_def_map,\n module_id\n)", + ], + ); + } + #[test] fn extend_selection_inside_macros() { do_check( -- cgit v1.2.3