提交 383ee752 编写于 作者: B Benjamin Pasero

Save dialog in new workspace window has wrong current directory (fixes #39336)

上级 5b0fa2ed
......@@ -94,7 +94,7 @@ export abstract class TextFileService implements ITextFileService {
abstract resolveTextContent(resource: URI, options?: IResolveContentOptions): TPromise<IRawTextContent>;
abstract promptForPath(defaultPath?: string): string;
abstract promptForPath(defaultPath: string): string;
abstract confirmSave(resources?: URI[]): ConfirmResult;
......@@ -626,6 +626,11 @@ export abstract class TextFileService implements ITextFileService {
return URI.file(paths.join(paths.dirname(lastActiveFile.fsPath), untitledFileName)).fsPath;
}
const lastActiveFolder = this.historyService.getLastActiveWorkspaceRoot('file');
if (lastActiveFolder) {
return URI.file(paths.join(lastActiveFolder.fsPath, untitledFileName)).fsPath;
}
return untitledFileName;
}
......
......@@ -135,11 +135,11 @@ export class TextFileService extends AbstractTextFileService {
return buttons[choice].result;
}
public promptForPath(defaultPath?: string): string {
public promptForPath(defaultPath: string): string {
return this.windowService.showSaveDialog(this.getSaveDialogOptions(defaultPath));
}
private getSaveDialogOptions(defaultPath?: string): Electron.SaveDialogOptions {
private getSaveDialogOptions(defaultPath: string): Electron.SaveDialogOptions {
const options: Electron.SaveDialogOptions = { defaultPath };
// Filters are only enabled on Windows where they work properly
......
......@@ -214,7 +214,7 @@ export class TestTextFileService extends TextFileService {
});
}
public promptForPath(defaultPath?: string): string {
public promptForPath(defaultPath: string): string {
return this.promptPath;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册