Skip to content

Commit

Permalink
Default to current dir for move to file select (#183875)
Browse files Browse the repository at this point in the history
Fixes #183870

`showOpenDialog` seems to ignore `defaultUri` if the file doesn't exist
  • Loading branch information
mjbvz authored May 30, 2023
1 parent 3370908 commit f4175f4
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ class MoveToFileRefactorCommand implements Command {
if (response.type !== 'response' || !response.body) {
return;
}
const defaultUri = this.client.toResource(response.body.newFileName);

const selectExistingFileItem: vscode.QuickPickItem = {
label: vscode.l10n.t("Select existing file..."),
Expand Down Expand Up @@ -226,14 +225,14 @@ class MoveToFileRefactorCommand implements Command {
const picked = await vscode.window.showOpenDialog({
title: vscode.l10n.t("Select move destination"),
openLabel: vscode.l10n.t("Move to File"),
defaultUri
defaultUri: Utils.dirname(document.uri),
});
return picked?.length ? this.client.toTsFilePath(picked[0]) : undefined;
} else if (picked === selectNewFileItem) {
const picked = await vscode.window.showSaveDialog({
title: vscode.l10n.t("Select move destination"),
saveLabel: vscode.l10n.t("Move to File"),
defaultUri,
defaultUri: this.client.toResource(response.body.newFileName),
});
return picked ? this.client.toTsFilePath(picked) : undefined;
} else {
Expand Down

0 comments on commit f4175f4

Please sign in to comment.