Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/refactorAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,14 @@ async function moveFile(languageClient: LanguageClient, fileUris: Uri[]) {
fileUris = moveUris;
}

const refactorEdit: RefactorWorkspaceEdit = await languageClient.sendRequest(MoveRequest.type, {
const refactorEdit = await requestMoveWithConfirmation(languageClient, {
moveKind: 'moveResource',
sourceUris: fileUris.map(uri => uri.toString()),
params: null,
destination: selectPackageNodeItem.packageNode,
updateReferences: true,
});

await applyRefactorEdit(languageClient, refactorEdit);
if (refactorEdit && refactorEdit.edit) {
await saveEdit(refactorEdit.edit);
}
Expand Down Expand Up @@ -466,13 +465,12 @@ async function moveStaticMember(languageClient: LanguageClient, params: CodeActi
const projectName = commandInfo ? commandInfo.projectName : null;
const picked = await selectTargetClass(languageClient, `Select the new class for the static member ${memberName}.`, projectName, exclude);
if (picked) {
const refactorEdit: RefactorWorkspaceEdit = await languageClient.sendRequest(MoveRequest.type, {
await requestMoveWithConfirmation(languageClient, {
moveKind: 'moveStaticMember',
sourceUris: [ params.textDocument.uri ],
params,
destination: picked,
});
await applyRefactorEdit(languageClient, refactorEdit);
}
}

Expand Down Expand Up @@ -546,9 +544,8 @@ async function moveType(languageClient: LanguageClient, params: CodeActionParams
return;
}

let refactorEdit: RefactorWorkspaceEdit;
if (picked.kind === 'newFile') {
refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
await requestMoveWithConfirmation(languageClient, {
moveKind: 'moveTypeToNewFile',
sourceUris: [ params.textDocument.uri ],
params,
Expand All @@ -562,14 +559,12 @@ async function moveType(languageClient: LanguageClient, params: CodeActionParams

const picked = await selectTargetClass(languageClient, `Select the new class for the type ${commandInfo.displayName}.`, commandInfo.projectName, exclude);
if (picked) {
refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
await requestMoveWithConfirmation(languageClient, {
moveKind: 'moveTypeToClass',
sourceUris: [ params.textDocument.uri ],
params,
destination: picked,
});
}
}

await applyRefactorEdit(languageClient, refactorEdit);
}
Loading