Trigger VSCode to rename after extract variable assist is applied

When the user applies the "Extract Variable" assist, the cursor is
positioned at the newly inserted variable. This commit adds a command
to the assist that triggers the rename action in VSCode. This way, the
user can quickly rename the variable after applying the assist.

Fixes part of: #17579
This commit is contained in:
bors 2024-07-11 08:55:34 +00:00 committed by Josh McKinney
parent 5577e4e3b1
commit 8efe8a8528
No known key found for this signature in database
GPG key ID: 722287396A903BC5
17 changed files with 80 additions and 33 deletions

View file

@ -45,7 +45,7 @@ pub(crate) fn ssr_assists(
group: Some(GroupLabel("Apply SSR".into())),
target: comment_range,
source_change,
trigger_signature_help: false,
command: None,
};
ssr_assists.push(assist);
@ -143,7 +143,7 @@ mod tests {
is_snippet: false,
},
),
trigger_signature_help: false,
command: None,
}
"#]]
.assert_debug_eq(&apply_in_file_assist);
@ -196,7 +196,7 @@ mod tests {
is_snippet: false,
},
),
trigger_signature_help: false,
command: None,
}
"#]]
.assert_debug_eq(&apply_in_workspace_assist);
@ -236,7 +236,7 @@ mod tests {
),
target: 10..21,
source_change: None,
trigger_signature_help: false,
command: None,
}
"#]]
.assert_debug_eq(&apply_in_file_assist);
@ -256,7 +256,7 @@ mod tests {
),
target: 10..21,
source_change: None,
trigger_signature_help: false,
command: None,
}
"#]]
.assert_debug_eq(&apply_in_workspace_assist);