Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export class FileDialogService implements IFileDialogService {
}

private ensureFileSchema(schema: string): string[] {
return schema !== Schemas.file ? [schema, Schemas.file] : [schema];
// Don't allow untitled schema through.
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
}

async pickFileFolderAndOpen(options: IPickAndOpenOptions): Promise<any> {
Expand Down Expand Up @@ -207,6 +208,7 @@ export class FileDialogService implements IFileDialogService {
}

private toNativeSaveDialogOptions(options: ISaveDialogOptions): Electron.SaveDialogOptions {
options.defaultUri = options.defaultUri ? URI.file(options.defaultUri.path) : undefined;
return {
defaultPath: options.defaultUri && options.defaultUri.fsPath,
buttonLabel: options.saveLabel,
Expand Down Expand Up @@ -286,12 +288,12 @@ export class FileDialogService implements IFileDialogService {
return remoteFileDialog.showSaveDialog(options);
}

private getSchemeFilterForWindow() {
private getSchemeFilterForWindow(): string {
return !this.environmentService.configuration.remoteAuthority ? Schemas.file : REMOTE_HOST_SCHEME;
}

private getFileSystemSchema(options: { availableFileSystems?: string[], defaultUri?: URI }): string {
return options.availableFileSystems && options.availableFileSystems[0] || options.defaultUri && options.defaultUri.scheme || this.getSchemeFilterForWindow();
return options.availableFileSystems && options.availableFileSystems[0] || this.getSchemeFilterForWindow();
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/vs/workbench/services/textfile/common/textFileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { createTextBufferFactoryFromSnapshot, createTextBufferFactoryFromStream
import { IModelService } from 'vs/editor/common/services/modelService';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { isEqualOrParent, isEqual, joinPath, dirname, extname, basename, toLocalResource } from 'vs/base/common/resources';
import { posix } from 'vs/base/common/path';
import { getConfirmMessage, IDialogService, IFileDialogService, ISaveDialogOptions, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
Expand Down Expand Up @@ -538,7 +537,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer

async confirmSave(resources?: URI[]): Promise<ConfirmResult> {
if (this.environmentService.isExtensionDevelopment) {
return ConfirmResult.DONT_SAVE; // no veto when we are in extension dev mode because we cannot assum we run interactive (e.g. tests)
return ConfirmResult.DONT_SAVE; // no veto when we are in extension dev mode because we cannot assume we run interactive (e.g. tests)
}

const resourcesToConfirm = this.getDirty(resources);
Expand Down Expand Up @@ -904,7 +903,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
return joinPath(lastActiveFolder, untitledFileName);
}

return schemeFilter === Schemas.file ? URI.file(untitledFileName) : URI.from({ scheme: schemeFilter, authority: remoteAuthority, path: posix.sep + untitledFileName });
return untitledResource.with({ path: untitledFileName });
}

async revert(resource: URI, options?: IRevertOptions): Promise<boolean> {
Expand Down