extend selection correctly handles commas in tuples

This commit is contained in:
Aleksey Kladov 2019-10-09 11:26:09 +03:00
parent 06a8deae4a
commit 8d65530843

View File

@ -32,6 +32,7 @@ fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange
PARAM_LIST,
ARG_LIST,
ARRAY_EXPR,
TUPLE_EXPR,
];
if range.is_empty() {
@ -245,6 +246,8 @@ mod tests {
do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|>];"#, &["33", ", 33"]);
do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|> ,];"#, &["33", ", 33"]);
do_check(r#"fn main() { (1, 2<|>) }"#, &["2", ", 2", "(1, 2)"]);
do_check(
r#"
const FOO: [usize; 2] = [