Merge from vscode 91e99652cd5fcfc072387c64e151b435e39e8dcf (#6962)

This commit is contained in:
Anthony Dresser
2019-08-26 15:58:42 -07:00
committed by GitHub
parent edf470c8fa
commit 507bae90b7
103 changed files with 1743 additions and 1543 deletions

View File

@@ -20,7 +20,6 @@ import * as Types from 'vs/base/common/types';
import { EditorType } from 'vs/editor/common/editorCommon';
import { Selection } from 'vs/editor/common/core/selection';
import { WorkbenchEnvironmentService } from 'vs/workbench/services/environment/node/environmentService';
import { parseArgs } from 'vs/platform/environment/node/argv';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@@ -632,11 +631,7 @@ class MockInputsConfigurationService extends TestConfigurationService {
class MockWorkbenchEnvironmentService extends WorkbenchEnvironmentService {
constructor(private env: platform.IProcessEnvironment) {
super(parseArgs(process.argv) as IWindowConfiguration, process.execPath);
}
get configuration(): IWindowConfiguration {
return { userEnv: this.env } as IWindowConfiguration;
constructor(env: platform.IProcessEnvironment) {
super({ userEnv: env } as IWindowConfiguration, process.execPath);
}
}

View File

@@ -18,6 +18,7 @@ import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
interface IMassagedMessageBoxOptions {
@@ -45,12 +46,13 @@ export class DialogService implements IDialogService {
@ILayoutService layoutService: ILayoutService,
@IThemeService themeService: IThemeService,
@IWindowService windowService: IWindowService,
@ISharedProcessService sharedProcessService: ISharedProcessService
@ISharedProcessService sharedProcessService: ISharedProcessService,
@IKeybindingService keybindingService: IKeybindingService
) {
// Use HTML based dialogs
if (configurationService.getValue('workbench.dialogs.customEnabled') === true) {
this.impl = new HTMLDialogService(logService, layoutService, themeService);
this.impl = new HTMLDialogService(logService, layoutService, themeService, keybindingService);
}
// Electron dialog service
else {
@@ -187,4 +189,4 @@ class NativeDialogService implements IDialogService {
}
}
registerSingleton(IDialogService, DialogService, true);
registerSingleton(IDialogService, DialogService, true);

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IResourceInput, ITextEditorOptions, IEditorOptions } from 'vs/platform/editor/common/editor';
import { IResourceInput, ITextEditorOptions, IEditorOptions, EditorActivation } from 'vs/platform/editor/common/editor';
import { IEditorInput, IEditor, GroupIdentifier, IFileEditorInput, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInputFactoryRegistry, Extensions as EditorExtensions, IFileInputFactory, EditorInput, SideBySideEditorInput, IEditorInputWithOptions, isEditorInputWithOptions, EditorOptions, TextEditorOptions, IEditorIdentifier, IEditorCloseEvent, ITextEditor, ITextDiffEditor, ITextSideBySideEditor, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInput';
@@ -19,7 +19,7 @@ import { basename } from 'vs/base/common/resources';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { localize } from 'vs/nls';
import { IEditorGroupsService, IEditorGroup, GroupsOrder, IEditorReplacement, GroupChangeKind, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IResourceEditor, ACTIVE_GROUP_TYPE, SIDE_GROUP_TYPE, SIDE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler, IVisibleEditor, IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IResourceEditor, SIDE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler, IVisibleEditor, IEditorService, SIDE_GROUP_TYPE, ACTIVE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Disposable, IDisposable, dispose, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { coalesce } from 'vs/base/common/arrays';
@@ -28,18 +28,16 @@ import { IEditorGroupView, IEditorOpeningEvent, EditorServiceImpl } from 'vs/wor
import { ILabelService } from 'vs/platform/label/common/label';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { withNullAsUndefined } from 'vs/base/common/types';
import { convertEditorInput, getFileMode } from 'sql/workbench/common/customInputConverter'; //{{SQL CARBON EDIT}}
//{{SQL CARBON EDIT}}
import { convertEditorInput, getFileMode } from 'sql/workbench/common/customInputConverter';
//{{SQL CARBON EDIT}} - End
type ICachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput;
type CachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput;
type OpenInEditorGroup = IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE;
export class EditorService extends Disposable implements EditorServiceImpl {
_serviceBrand!: ServiceIdentifier<any>;
private static CACHE: ResourceMap<ICachedEditorInput> = new ResourceMap<ICachedEditorInput>();
private static CACHE: ResourceMap<CachedEditorInput> = new ResourceMap<CachedEditorInput>();
//#region events
@@ -220,46 +218,78 @@ export class EditorService extends Disposable implements EditorServiceImpl {
//#region openEditor()
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<IEditor | undefined>;
openEditor(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<ITextEditor | undefined>;
openEditor(editor: IResourceDiffInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<ITextDiffEditor | undefined>;
openEditor(editor: IResourceSideBySideInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<ITextSideBySideEditor | undefined>;
openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE, group?: GroupIdentifier): Promise<IEditor | undefined> {
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: OpenInEditorGroup): Promise<IEditor | undefined>;
openEditor(editor: IResourceInput | IUntitledResourceInput, group?: OpenInEditorGroup): Promise<ITextEditor | undefined>;
openEditor(editor: IResourceDiffInput, group?: OpenInEditorGroup): Promise<ITextDiffEditor | undefined>;
openEditor(editor: IResourceSideBySideInput, group?: OpenInEditorGroup): Promise<ITextSideBySideEditor | undefined>;
async openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | OpenInEditorGroup, group?: OpenInEditorGroup): Promise<IEditor | undefined> {
let resolvedGroup: IEditorGroup | undefined;
let candidateGroup: OpenInEditorGroup | undefined;
let typedEditor: EditorInput | undefined;
let typedOptions: EditorOptions | undefined;
// Typed Editor Support
if (editor instanceof EditorInput) {
const editorOptions = this.toOptions(optionsOrGroup as IEditorOptions);
const targetGroup = this.findTargetGroup(editor, editorOptions, group);
typedEditor = editor;
typedOptions = this.toOptions(optionsOrGroup as IEditorOptions);
return this.doOpenEditor(targetGroup, editor, editorOptions);
candidateGroup = group;
resolvedGroup = this.findTargetGroup(typedEditor, typedOptions, candidateGroup);
}
// Untyped Text Editor Support
const textInput = <IResourceEditor>editor;
const typedInput = this.createInput(textInput);
if (typedInput) {
const editorOptions = TextEditorOptions.from(textInput);
const targetGroup = this.findTargetGroup(typedInput, editorOptions, optionsOrGroup as IEditorGroup | GroupIdentifier);
return this.doOpenEditor(targetGroup, typedInput, editorOptions);
else {
const textInput = <IResourceEditor>editor;
typedEditor = this.createInput(textInput);
if (typedEditor) {
typedOptions = TextEditorOptions.from(textInput);
candidateGroup = optionsOrGroup as OpenInEditorGroup;
resolvedGroup = this.findTargetGroup(typedEditor, typedOptions, candidateGroup);
}
}
return Promise.resolve(undefined);
if (typedEditor && resolvedGroup) {
if (
this.editorGroupService.activeGroup !== resolvedGroup && // only if target group is not already active
typedOptions && !typedOptions.inactive && // never for inactive editors
typedOptions.preserveFocus && // only if preserveFocus
typeof typedOptions.activation !== 'number' && // only if activation is not already defined (either true or false)
candidateGroup !== SIDE_GROUP // never for the SIDE_GROUP
) {
// If the resolved group is not the active one, we typically
// want the group to become active. There are a few cases
// where we stay away from encorcing this, e.g. if the caller
// is already providing `activation`.
//
// Specifically for historic reasons we do not activate a
// group is it is opened as `SIDE_GROUP` with `preserveFocus:true`.
// repeated Alt-clicking of files in the explorer always open
// into the same side group and not cause a group to be created each time.
typedOptions.overwrite({ activation: EditorActivation.ACTIVATE });
}
return this.doOpenEditor(resolvedGroup, typedEditor, typedOptions);
}
return undefined;
}
protected doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise<IEditor | undefined> {
return group.openEditor(editor, options).then(withNullAsUndefined);
protected async doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise<IEditor | undefined> {
return withNullAsUndefined(await group.openEditor(editor, options));
}
private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): IEditorGroup {
private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: OpenInEditorGroup): IEditorGroup {
let targetGroup: IEditorGroup | undefined;
// Group: Instance of Group
if (group && typeof group !== 'number') {
return group;
targetGroup = group;
}
// Group: Side by Side
if (group === SIDE_GROUP) {
else if (group === SIDE_GROUP) {
targetGroup = this.findSideBySideGroup();
}
@@ -347,9 +377,9 @@ export class EditorService extends Disposable implements EditorServiceImpl {
//#region openEditors()
openEditors(editors: IEditorInputWithOptions[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<IEditor[]>;
openEditors(editors: IResourceEditor[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<IEditor[]>;
async openEditors(editors: Array<IEditorInputWithOptions | IResourceEditor>, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise<IEditor[]> {
openEditors(editors: IEditorInputWithOptions[], group?: OpenInEditorGroup): Promise<IEditor[]>;
openEditors(editors: IResourceEditor[], group?: OpenInEditorGroup): Promise<IEditor[]>;
async openEditors(editors: Array<IEditorInputWithOptions | IResourceEditor>, group?: OpenInEditorGroup): Promise<IEditor[]> {
// Convert to typed editors and options
const typedEditors: IEditorInputWithOptions[] = [];
@@ -379,22 +409,20 @@ export class EditorService extends Disposable implements EditorServiceImpl {
});
}
// Open in targets
// Open in target groups
const result: Promise<IEditor | null>[] = [];
mapGroupToEditors.forEach((editorsWithOptions, group) => {
result.push(group.openEditors(editorsWithOptions));
});
const openedEditors = await Promise.all(result);
return coalesce(openedEditors);
return coalesce(await Promise.all(result));
}
//#endregion
//#region isOpen()
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): boolean {
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput): boolean {
return !!this.doGetOpened(editor);
}
@@ -402,11 +430,11 @@ export class EditorService extends Disposable implements EditorServiceImpl {
//#region getOpend()
getOpened(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): IEditorInput | undefined {
getOpened(editor: IResourceInput | IUntitledResourceInput): IEditorInput | undefined {
return this.doGetOpened(editor);
}
private doGetOpened(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): IEditorInput | undefined {
private doGetOpened(editor: IEditorInput | IResourceInput | IUntitledResourceInput): IEditorInput | undefined {
if (!(editor instanceof EditorInput)) {
const resourceInput = editor as IResourceInput | IUntitledResourceInput;
if (!resourceInput.resource) {
@@ -414,20 +442,8 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
}
let groups: IEditorGroup[] = [];
if (typeof group === 'number') {
const groupView = this.editorGroupService.getGroup(group);
if (groupView) {
groups.push(groupView);
}
} else if (group) {
groups.push(group);
} else {
groups = [...this.editorGroupService.groups];
}
// For each editor group
for (const group of groups) {
for (const group of this.editorGroupService.groups) {
// Typed editor
if (editor instanceof EditorInput) {
@@ -574,7 +590,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
throw new Error('Unknown input type');
}
private createOrGet(resource: URI, instantiationService: IInstantiationService, label: string | undefined, description: string | undefined, encoding: string | undefined, mode: string | undefined, forceFile: boolean | undefined): ICachedEditorInput {
private createOrGet(resource: URI, instantiationService: IInstantiationService, label: string | undefined, description: string | undefined, encoding: string | undefined, mode: string | undefined, forceFile: boolean | undefined): CachedEditorInput {
if (EditorService.CACHE.has(resource)) {
const input = EditorService.CACHE.get(resource)!;
if (input instanceof ResourceEditorInput) {
@@ -602,9 +618,8 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return input;
}
let input: ICachedEditorInput;
// File
let input: CachedEditorInput;
if (forceFile /* fix for https://github.com/Microsoft/vscode/issues/48275 */ || this.fileService.canHandleResource(resource)) {
input = this.fileInputFactory.createFileInput(resource, encoding, mode, instantiationService);
}
@@ -645,7 +660,12 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}
export interface IEditorOpenHandler {
(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions): Promise<IEditor | null>;
(
delegate: (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => Promise<IEditor | undefined>,
group: IEditorGroup,
editor: IEditorInput,
options?: IEditorOptions | ITextEditorOptions
): Promise<IEditor | null>;
}
/**
@@ -682,7 +702,13 @@ export class DelegatingEditorService extends EditorService {
return super.doOpenEditor(group, editor, options);
}
const control = await this.editorOpenHandler(group, editor, options);
const control = await this.editorOpenHandler(
(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => super.doOpenEditor(group, editor, options),
group,
editor,
options
);
if (control) {
return control; // the opening was handled, so return early
}

View File

@@ -330,7 +330,7 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite
const inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource-delegate'), undefined);
const delegate = instantiationService.createInstance(DelegatingEditorService);
delegate.setEditorOpenHandler((group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => {
delegate.setEditorOpenHandler((delegate, group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => {
assert.strictEqual(input, inp);
done();

View File

@@ -96,11 +96,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
break: false
};
this.webviewEndpoint = options.webviewEndpoint;
this.untitledWorkspacesHome = URI.from({ scheme: Schemas.untitled, path: 'Workspaces' });
if (document && document.location && document.location.search) {
const map = new Map<string, string>();
const query = document.location.search.substring(1);
const vars = query.split('&');
@@ -170,7 +168,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
verbose: boolean;
skipGettingStarted: boolean;
skipReleaseNotes: boolean;
skipAddToRecentlyOpened: boolean;
mainIPCHandle: string;
sharedIPCHandle: string;
nodeCachedDataDir?: string;
@@ -179,16 +176,15 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
disableCrashReporter: boolean;
driverHandle?: string;
driverVerbose: boolean;
webviewEndpoint?: string;
galleryMachineIdResource?: URI;
readonly logFile: URI;
get webviewResourceRoot(): string {
return this.webviewEndpoint ? this.webviewEndpoint + '/vscode-resource{{resource}}' : 'vscode-resource:{{resource}}';
return this.options.webviewEndpoint ? `${this.options.webviewEndpoint}/vscode-resource{{resource}}` : 'vscode-resource:{{resource}}';
}
get webviewCspSource(): string {
return this.webviewEndpoint ? this.webviewEndpoint : 'vscode-resource:';
return this.options.webviewEndpoint ? this.options.webviewEndpoint : 'vscode-resource:';
}
}

View File

@@ -5,7 +5,7 @@
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IEnvironmentService, IDebugParams } from 'vs/platform/environment/common/environment';
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
import { URI } from 'vs/base/common/uri';
@@ -17,7 +17,17 @@ export interface IWorkbenchEnvironmentService extends IEnvironmentService {
readonly configuration: IWindowConfiguration;
readonly logFile: URI;
readonly options?: IWorkbenchConstructionOptions;
readonly logFile: URI;
readonly logExtensionHostCommunication: boolean;
readonly debugSearch: IDebugParams;
readonly webviewResourceRoot: string;
readonly webviewCspSource: string;
readonly skipGettingStarted: boolean | undefined;
readonly skipReleaseNotes: boolean | undefined;
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { EnvironmentService, parseSearchPort } from 'vs/platform/environment/node/environmentService';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { memoize } from 'vs/base/common/decorators';
@@ -12,27 +12,36 @@ import { Schemas } from 'vs/base/common/network';
import { toBackupWorkspaceResource } from 'vs/workbench/services/backup/common/backup';
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { join } from 'vs/base/common/path';
import { IDebugParams } from 'vs/platform/environment/common/environment';
export class WorkbenchEnvironmentService extends EnvironmentService implements IWorkbenchEnvironmentService {
_serviceBrand!: ServiceIdentifier<any>;
readonly webviewResourceRoot = 'vscode-resource:{{resource}}';
readonly webviewCspSource = 'vscode-resource:';
constructor(
private _configuration: IWindowConfiguration,
readonly configuration: IWindowConfiguration,
execPath: string
) {
super(_configuration, execPath);
super(configuration, execPath);
this._configuration.backupWorkspaceResource = this._configuration.backupPath ? toBackupWorkspaceResource(this._configuration.backupPath, this) : undefined;
this.configuration.backupWorkspaceResource = this.configuration.backupPath ? toBackupWorkspaceResource(this.configuration.backupPath, this) : undefined;
}
get configuration(): IWindowConfiguration {
return this._configuration;
}
get skipGettingStarted(): boolean { return !!this.args['skip-getting-started']; }
get skipReleaseNotes(): boolean { return !!this.args['skip-release-notes']; }
@memoize
get userRoamingDataHome(): URI { return this.appSettingsHome.with({ scheme: Schemas.userData }); }
@memoize
get logFile(): URI { return URI.file(join(this.logsPath, `renderer${this.configuration.windowId}.log`)); }
get logExtensionHostCommunication(): boolean { return !!this.args.logExtensionHostCommunication; }
@memoize
get debugSearch(): IDebugParams { return parseSearchPort(this.args, this.isBuilt); }
}

View File

@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import * as strings from 'vs/base/common/strings';
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ExtHostCustomersRegistry } from 'vs/workbench/api/common/extHostCustomers';
import { ExtHostContext, ExtHostExtensionServiceShape, IExtHostContext, MainContext } from 'vs/workbench/api/common/extHost.protocol';
@@ -59,7 +59,7 @@ export class ExtensionHostProcessManager extends Disposable {
private readonly _remoteAuthority: string,
initialActivationEvents: string[],
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService,
) {
super();
this._extensionHostProcessFinishedActivateEvents = Object.create(null);

View File

@@ -5,7 +5,7 @@
import { Emitter, Event } from 'vs/base/common/event';
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ILabelService } from 'vs/platform/label/common/label';
import { ILogService } from 'vs/platform/log/common/log';
import { connectRemoteAgentExtensionHost, IRemoteExtensionHostStartParams, IConnectionOptions, ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection';
@@ -49,7 +49,7 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH
private readonly _initDataProvider: IInitDataProvider,
private readonly _socketFactory: ISocketFactory,
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@ILifecycleService private readonly _lifecycleService: ILifecycleService,
@ILogService private readonly _logService: ILogService,

View File

@@ -489,7 +489,14 @@ export class ExtensionService extends AbstractExtensionService implements IExten
}
// fetch the remote environment
const remoteEnv = (await this._remoteAgentService.getEnvironment())!;
const remoteEnv = (await this._remoteAgentService.getEnvironment());
if (!remoteEnv) {
this._notificationService.notify({ severity: Severity.Error, message: nls.localize('getEnvironmentFailure', "Could not fetch remote environment") });
// Proceed with the local extension host
await this._startLocalExtensionHost(extensionHost, localExtensions, localExtensions.map(extension => extension.identifier));
return;
}
// enable or disable proposed API per extension
this._checkEnableProposedApi(remoteEnv.extensions);

View File

@@ -19,8 +19,8 @@ declare namespace self {
let close: any;
let postMessage: any;
let addEventLister: any;
let indexedDB: any;
let caches: any;
let indexedDB: { open: any, [k: string]: any };
let caches: { open: any, [k: string]: any };
}
const nativeClose = self.close.bind(self);
@@ -32,9 +32,8 @@ self.postMessage = () => console.trace(`'postMessage' has been blocked`);
const nativeAddEventLister = addEventListener.bind(self);
self.addEventLister = () => console.trace(`'addEventListener' has been blocked`);
// readonly, cannot redefine...
// self.indexedDB = undefined;
// self.caches = undefined;
self.indexedDB.open = () => console.trace(`'indexedDB.open' has been blocked`);
self.caches.open = () => console.trace(`'indexedDB.caches' has been blocked`);
//#endregion ---

View File

@@ -129,7 +129,10 @@ export class LabelService implements ILabelService {
}
getUriLabel(resource: URI, options: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean } = {}): string {
const formatting = this.findFormatting(resource);
return this.doGetUriLabel(resource, this.findFormatting(resource), options);
}
private doGetUriLabel(resource: URI, formatting?: ResourceLabelFormatting, options: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean } = {}): string {
if (!formatting) {
return getPathLabel(resource.path, this.environmentService, options.relative ? this.contextService : undefined);
}
@@ -161,13 +164,16 @@ export class LabelService implements ILabelService {
}
getUriBasenameLabel(resource: URI): string {
const label = this.getUriLabel(resource);
const formatting = this.findFormatting(resource);
if (formatting && formatting.separator === '\\') {
return paths.win32.basename(label);
const label = this.doGetUriLabel(resource, formatting);
if (formatting) {
switch (formatting.separator) {
case paths.win32.sep: return paths.win32.basename(label);
case paths.posix.sep: return paths.posix.basename(label);
}
}
return paths.posix.basename(label);
return paths.basename(label);
}
getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string {

View File

@@ -214,7 +214,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
private openSettings2(options?: ISettingsEditorOptions): Promise<IEditor> {
const input = this.settingsEditor2Input;
return this.editorGroupService.activeGroup.openEditor(input, options)
return this.editorService.openEditor(input, options)
.then(() => this.editorGroupService.activeGroup.activeControl!);
}

View File

@@ -160,14 +160,14 @@ export class KeybindingsEditorModel extends EditorModel {
return result;
}
resolve(editorActionsLabels: Map<string, string>): Promise<EditorModel> {
resolve(actionLabels: Map<string, string>): Promise<EditorModel> {
const workbenchActionsRegistry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
this._keybindingItemsSortedByPrecedence = [];
const boundCommands: Map<string, boolean> = new Map<string, boolean>();
for (const keybinding of this.keybindingsService.getKeybindings()) {
if (keybinding.command) { // Skip keybindings without commands
this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(keybinding.command, keybinding, workbenchActionsRegistry, editorActionsLabels));
this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(keybinding.command, keybinding, workbenchActionsRegistry, actionLabels));
boundCommands.set(keybinding.command, true);
}
}
@@ -175,7 +175,7 @@ export class KeybindingsEditorModel extends EditorModel {
const commandsWithDefaultKeybindings = this.keybindingsService.getDefaultKeybindings().map(keybinding => keybinding.command);
for (const command of KeybindingResolver.getAllUnboundCommands(boundCommands)) {
const keybindingItem = new ResolvedKeybindingItem(undefined, command, null, undefined, commandsWithDefaultKeybindings.indexOf(command) === -1);
this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(command, keybindingItem, workbenchActionsRegistry, editorActionsLabels));
this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(command, keybindingItem, workbenchActionsRegistry, actionLabels));
}
this._keybindingItems = this._keybindingItemsSortedByPrecedence.slice(0).sort((a, b) => KeybindingsEditorModel.compareKeybindingData(a, b));
return Promise.resolve(this);
@@ -209,9 +209,9 @@ export class KeybindingsEditorModel extends EditorModel {
return a.command.localeCompare(b.command);
}
private static toKeybindingEntry(command: string, keybindingItem: ResolvedKeybindingItem, workbenchActionsRegistry: IWorkbenchActionRegistry, editorActions: Map<string, string>): IKeybindingItem {
private static toKeybindingEntry(command: string, keybindingItem: ResolvedKeybindingItem, workbenchActionsRegistry: IWorkbenchActionRegistry, actions: Map<string, string>): IKeybindingItem {
const menuCommand = MenuRegistry.getCommand(command)!;
const editorActionLabel = editorActions.get(command)!;
const editorActionLabel = actions.get(command)!;
return <IKeybindingItem>{
keybinding: keybindingItem.resolvedKeybinding,
keybindingItem,
@@ -264,13 +264,13 @@ class KeybindingItemMatches {
this.commandLabelMatches = keybindingItem.commandLabel ? this.matches(searchValue, keybindingItem.commandLabel, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.commandLabel, true), words) : null;
this.commandDefaultLabelMatches = keybindingItem.commandDefaultLabel ? this.matches(searchValue, keybindingItem.commandDefaultLabel, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.commandDefaultLabel, true), words) : null;
this.sourceMatches = this.matches(searchValue, keybindingItem.source, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.source, true), words);
this.whenMatches = keybindingItem.when ? this.matches(searchValue, keybindingItem.when, or(matchesWords, matchesCamelCase), words) : null;
this.whenMatches = keybindingItem.when ? this.matches(null, keybindingItem.when, or(matchesWords, matchesCamelCase), words) : null;
}
this.keybindingMatches = keybindingItem.keybinding ? this.matchesKeybinding(keybindingItem.keybinding, searchValue, keybindingWords, completeMatch) : null;
}
private matches(searchValue: string, wordToMatchAgainst: string, wordMatchesFilter: IFilter, words: string[]): IMatch[] | null {
let matches = wordFilter(searchValue, wordToMatchAgainst);
private matches(searchValue: string | null, wordToMatchAgainst: string, wordMatchesFilter: IFilter, words: string[]): IMatch[] | null {
let matches = searchValue ? wordFilter(searchValue, wordToMatchAgainst) : null;
if (!matches) {
matches = this.matchesWords(words, wordToMatchAgainst, wordMatchesFilter);
}

View File

@@ -167,20 +167,12 @@ export class SettingsEditorOptions extends EditorOptions implements ISettingsEdi
static create(settings: ISettingsEditorOptions): SettingsEditorOptions {
const options = new SettingsEditorOptions();
options.overwrite(settings);
options.target = settings.target;
options.folderUri = settings.folderUri;
options.query = settings.query;
// IEditorOptions
options.preserveFocus = settings.preserveFocus;
options.forceReload = settings.forceReload;
options.revealIfVisible = settings.revealIfVisible;
options.revealIfOpened = settings.revealIfOpened;
options.pinned = settings.pinned;
options.index = settings.index;
options.inactive = settings.inactive;
return options;
}
}

View File

@@ -348,7 +348,9 @@ export class ProgressService extends Disposable implements IProgressService {
const disposables = new DisposableStore();
const allowableCommands = [
'workbench.action.quit',
'workbench.action.reloadWindow'
'workbench.action.reloadWindow',
'copy',
'cut'
];
let dialog: Dialog;

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request';
import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService } from 'vs/platform/log/common/log';

View File

@@ -12,7 +12,8 @@ import { URI as uri } from 'vs/base/common/uri';
import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc';
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IDebugParams } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { FileMatch, IFileMatch, IFileQuery, IProgressMessage, IRawSearchService, ISearchComplete, ISearchConfiguration, ISearchProgressItem, ISearchResultProvider, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess, ITextQuery, ISearchService } from 'vs/workbench/services/search/common/search';
@@ -35,7 +36,7 @@ export class LocalSearchService extends SearchService {
@ILogService logService: ILogService,
@IExtensionService extensionService: IExtensionService,
@IFileService fileService: IFileService,
@IEnvironmentService readonly environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService readonly environmentService: IWorkbenchEnvironmentService,
@IInstantiationService readonly instantiationService: IInstantiationService
) {
super(modelService, untitledEditorService, editorService, telemetryService, logService, extensionService, fileService);

View File

@@ -685,7 +685,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer
protected async promptForPath(resource: URI, defaultUri: URI, availableFileSystems?: string[]): Promise<URI | undefined> {
// Help user to find a name for the file by opening it first
await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true, } });
await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true } });
return this.fileDialogService.pickFileToSave(this.getSaveDialogOptions(defaultUri, availableFileSystems));
}