mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-22 01:52:56 +00:00
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:
parent
5577e4e3b1
commit
8efe8a8528
17 changed files with 80 additions and 33 deletions
|
@ -348,6 +348,7 @@ class ExperimentalFeatures implements lc.StaticFeature {
|
|||
"rust-analyzer.showReferences",
|
||||
"rust-analyzer.gotoLocation",
|
||||
"editor.action.triggerParameterHints",
|
||||
"editor.action.rename",
|
||||
],
|
||||
},
|
||||
...capabilities.experimental,
|
||||
|
|
|
@ -118,6 +118,12 @@ export function triggerParameterHints(_: CtxInit): Cmd {
|
|||
};
|
||||
}
|
||||
|
||||
export function rename(_: CtxInit): Cmd {
|
||||
return async () => {
|
||||
await vscode.commands.executeCommand("editor.action.rename");
|
||||
};
|
||||
}
|
||||
|
||||
export function openLogs(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
if (ctx.client.outputChannel) {
|
||||
|
|
|
@ -190,6 +190,7 @@ function createCommands(): Record<string, CommandFactory> {
|
|||
runSingle: { enabled: commands.runSingle },
|
||||
showReferences: { enabled: commands.showReferences },
|
||||
triggerParameterHints: { enabled: commands.triggerParameterHints },
|
||||
rename: { enabled: commands.rename },
|
||||
openLogs: { enabled: commands.openLogs },
|
||||
revealDependency: { enabled: commands.revealDependency },
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue