Skip to content

Commit f4175f4

Browse files
authored
Default to current dir for move to file select (microsoft#183875)
Fixes microsoft#183870 `showOpenDialog` seems to ignore `defaultUri` if the file doesn't exist
1 parent 3370908 commit f4175f4

File tree

1 file changed

+2
-3
lines changed
  • extensions/typescript-language-features/src/languageFeatures

1 file changed

+2
-3
lines changed

extensions/typescript-language-features/src/languageFeatures/refactor.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ class MoveToFileRefactorCommand implements Command {
175175
if (response.type !== 'response' || !response.body) {
176176
return;
177177
}
178-
const defaultUri = this.client.toResource(response.body.newFileName);
179178

180179
const selectExistingFileItem: vscode.QuickPickItem = {
181180
label: vscode.l10n.t("Select existing file..."),
@@ -226,14 +225,14 @@ class MoveToFileRefactorCommand implements Command {
226225
const picked = await vscode.window.showOpenDialog({
227226
title: vscode.l10n.t("Select move destination"),
228227
openLabel: vscode.l10n.t("Move to File"),
229-
defaultUri
228+
defaultUri: Utils.dirname(document.uri),
230229
});
231230
return picked?.length ? this.client.toTsFilePath(picked[0]) : undefined;
232231
} else if (picked === selectNewFileItem) {
233232
const picked = await vscode.window.showSaveDialog({
234233
title: vscode.l10n.t("Select move destination"),
235234
saveLabel: vscode.l10n.t("Move to File"),
236-
defaultUri,
235+
defaultUri: this.client.toResource(response.body.newFileName),
237236
});
238237
return picked ? this.client.toTsFilePath(picked) : undefined;
239238
} else {

0 commit comments

Comments
 (0)