Is there any why to trigger Rename Variable from a Extension?
I found an example how to rename a certain word in a file, but the reference variables keep the same as before.
Is there any why to trigger Rename Variable from a Extension?
I found an example how to rename a certain word in a file, but the reference variables keep the same as before.
Try using the vscode.executeDocumentRenameProvider
command:
import * as vscode from 'vscode' vscode.commands.executeCommand('vscode.executeDocumentRenameProvider', vscode.window.activeTextEditor.document.uri, new vscode.Position(targetLine, targetCharacter), 'newSymbolName').then(edit => { if (!edit) { return false; } return vscode.workspace.applyEdit(edit); })
This will utilize the RenameProvider
that is registered for the target file. If no such RenameProvider
exists, you will need to implement one