3233: Extend selection handles commas in tuple pats r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-02-19 13:00:04 +00:00 committed by GitHub
commit 61fdcc5ded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(