mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Default to current dir for move to file
select (#183875)
Fixes #183870 `showOpenDialog` seems to ignore `defaultUri` if the file doesn't exist
This commit is contained in:
parent
3370908fd1
commit
f4175f4a13
|
@ -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..."),
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue