mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d
This commit is contained in:
committed by
AzureDataStudio
parent
a8a7559229
commit
1388493cc1
@@ -25,6 +25,7 @@ import { coalesce } from 'vs/base/common/arrays';
|
||||
import { trim } from 'vs/base/common/strings';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
|
||||
export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
|
||||
@@ -218,21 +219,17 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
}
|
||||
|
||||
private pickResource(options: IOpenDialogOptions): Promise<URI | undefined> {
|
||||
const simpleFileDialog = this.createSimpleFileDialog();
|
||||
const simpleFileDialog = this.instantiationService.createInstance(SimpleFileDialog);
|
||||
|
||||
return simpleFileDialog.showOpenDialog(options);
|
||||
}
|
||||
|
||||
private saveRemoteResource(options: ISaveDialogOptions): Promise<URI | undefined> {
|
||||
const remoteFileDialog = this.createSimpleFileDialog();
|
||||
const remoteFileDialog = this.instantiationService.createInstance(SimpleFileDialog);
|
||||
|
||||
return remoteFileDialog.showSaveDialog(options);
|
||||
}
|
||||
|
||||
protected createSimpleFileDialog(): SimpleFileDialog {
|
||||
return this.instantiationService.createInstance(SimpleFileDialog);
|
||||
}
|
||||
|
||||
protected getSchemeFilterForWindow(): string {
|
||||
return !this.environmentService.configuration.remoteAuthority ? Schemas.file : REMOTE_HOST_SCHEME;
|
||||
}
|
||||
@@ -254,7 +251,7 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
const options: ISaveDialogOptions = {
|
||||
defaultUri,
|
||||
title: nls.localize('saveAsTitle', "Save As"),
|
||||
availableFileSystems,
|
||||
availableFileSystems
|
||||
};
|
||||
|
||||
interface IFilter { name: string; extensions: string[]; }
|
||||
@@ -282,8 +279,12 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
// We have no matching filter, e.g. because the language
|
||||
// is unknown. We still add the extension to the list of
|
||||
// filters though so that it can be picked
|
||||
// (https://github.com/microsoft/vscode/issues/96283)
|
||||
if (!matchingFilter && ext) {
|
||||
// (https://github.com/microsoft/vscode/issues/96283) but
|
||||
// only on Windows where this is an issue. Adding this to
|
||||
// macOS would result in the following bugs:
|
||||
// https://github.com/microsoft/vscode/issues/100614 and
|
||||
// https://github.com/microsoft/vscode/issues/100241
|
||||
if (isWindows && !matchingFilter && ext) {
|
||||
matchingFilter = { name: trim(ext, '.').toUpperCase(), extensions: [trim(ext, '.')] };
|
||||
}
|
||||
|
||||
|
||||
@@ -231,8 +231,8 @@ export class SimpleFileDialog {
|
||||
return this.remoteAgentEnvironment;
|
||||
}
|
||||
|
||||
protected async getUserHome(): Promise<URI> {
|
||||
return (await this.pathService.userHome) ?? URI.from({ scheme: this.scheme, authority: this.remoteAuthority, path: '/' });
|
||||
protected getUserHome(): Promise<URI> {
|
||||
return this.pathService.userHome({ preferLocal: this.scheme === Schemas.file });
|
||||
}
|
||||
|
||||
private async pickResource(isSave: boolean = false): Promise<URI | undefined> {
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { SimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { IPathService } from 'vs/workbench/services/path/common/pathService';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
|
||||
export class NativeSimpleFileDialog extends SimpleFileDialog {
|
||||
constructor(
|
||||
@IFileService fileService: IFileService,
|
||||
@IQuickInputService quickInputService: IQuickInputService,
|
||||
@ILabelService labelService: ILabelService,
|
||||
@IWorkspaceContextService workspaceContextService: IWorkspaceContextService,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IFileDialogService fileDialogService: IFileDialogService,
|
||||
@IModelService modelService: IModelService,
|
||||
@IModeService modeService: IModeService,
|
||||
@IWorkbenchEnvironmentService protected environmentService: INativeWorkbenchEnvironmentService,
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
||||
@IPathService protected pathService: IPathService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
) {
|
||||
super(fileService, quickInputService, labelService, workspaceContextService, notificationService, fileDialogService, modelService, modeService, environmentService, remoteAgentService, pathService, keybindingService, contextKeyService);
|
||||
}
|
||||
|
||||
protected async getUserHome(): Promise<URI> {
|
||||
if (this.scheme !== Schemas.file) {
|
||||
return super.getUserHome();
|
||||
}
|
||||
return this.environmentService.userHome;
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,6 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { SimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog';
|
||||
import { NativeSimpleFileDialog } from 'vs/workbench/services/dialogs/electron-browser/simpleFileDialog';
|
||||
|
||||
export class FileDialogService extends AbstractFileDialogService implements IFileDialogService {
|
||||
|
||||
@@ -191,10 +189,6 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
|
||||
// Don't allow untitled schema through.
|
||||
return schema === Schemas.untitled ? [Schemas.file] : (schema !== Schemas.file ? [schema, Schemas.file] : [schema]);
|
||||
}
|
||||
|
||||
protected createSimpleFileDialog(): SimpleFileDialog {
|
||||
return this.instantiationService.createInstance(NativeSimpleFileDialog);
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IFileDialogService, FileDialogService, true);
|
||||
Reference in New Issue
Block a user