Vscode merge (#4582)

* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd

* fix issues with merges

* bump node version in azpipe

* replace license headers

* remove duplicate launch task

* fix build errors

* fix build errors

* fix tslint issues

* working through package and linux build issues

* more work

* wip

* fix packaged builds

* working through linux build errors

* wip

* wip

* wip

* fix mac and linux file limits

* iterate linux pipeline

* disable editor typing

* revert series to parallel

* remove optimize vscode from linux

* fix linting issues

* revert testing change

* add work round for new node

* readd packaging for extensions

* fix issue with angular not resolving decorator dependencies
This commit is contained in:
Anthony Dresser
2019-03-19 17:44:35 -07:00
committed by GitHub
parent 833d197412
commit 87765e8673
1879 changed files with 54505 additions and 38058 deletions

View File

@@ -44,7 +44,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
KeybindingsRegistry.registerKeybindingRule({
id: descriptor.id,
weight: weight,
when: descriptor.keybindingContext,
when: (descriptor.keybindingContext || when ? ContextKeyExpr.and(descriptor.keybindingContext, when) : null),
primary: keybindings ? keybindings.primary : 0,
secondary: keybindings && keybindings.secondary,
win: keybindings && keybindings.win,
@@ -54,7 +54,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
// menu item
// TODO@Rob slightly weird if-check required because of
// https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/search/electron-browser/search.contribution.ts#L266
// https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/contrib/search/electron-browser/search.contribution.ts#L266
if (descriptor.label) {
let idx = alias.indexOf(': ');

View File

@@ -27,7 +27,7 @@ export interface IGlobalActivityRegistry {
export class GlobalActivityRegistry implements IGlobalActivityRegistry {
private activityDescriptors = new Set<IConstructorSignature0<IGlobalActivity>>();
private readonly activityDescriptors = new Set<IConstructorSignature0<IGlobalActivity>>();
registerActivity(descriptor: IConstructorSignature0<IGlobalActivity>): void {
this.activityDescriptors.add(descriptor);
@@ -36,6 +36,7 @@ export class GlobalActivityRegistry implements IGlobalActivityRegistry {
getActivities(): IConstructorSignature0<IGlobalActivity>[] {
const result: IConstructorSignature0<IGlobalActivity>[] = [];
this.activityDescriptors.forEach(d => result.push(d));
return result;
}
}

View File

@@ -9,11 +9,10 @@ import { Themable } from 'vs/workbench/common/theme';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
export class Component extends Themable {
private id: string;
private memento: Memento;
private readonly memento: Memento;
constructor(
id: string,
private readonly id: string,
themeService: IThemeService,
storageService: IStorageService
) {

View File

@@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { isMacintosh, isLinux, isWindows } from 'vs/base/common/platform';
export const IsMacContext = new RawContextKey<boolean>('isMac', isMacintosh);
export const IsLinuxContext = new RawContextKey<boolean>('isLinux', isLinux);
export const IsWindowsContext = new RawContextKey<boolean>('isWindows', isWindows);
export const HasMacNativeTabsContext = new RawContextKey<boolean>('hasMacNativeTabs', false);
export const SupportsWorkspacesContext = new RawContextKey<boolean>('supportsWorkspaces', true);
export const SupportsOpenFileFolderContext = new RawContextKey<boolean>('supportsOpenFileFolder', isMacintosh);
export const IsDevelopmentContext = new RawContextKey<boolean>('isDevelopment', false);
export const WorkbenchStateContext = new RawContextKey<string>('workbenchState', undefined);
export const WorkspaceFolderCountContext = new RawContextKey<number>('workspaceFolderCount', 0);

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import { runWhenIdle, IdleDeadline } from 'vs/base/common/async';
@@ -34,15 +34,14 @@ export interface IWorkbenchContributionsRegistry {
/**
* Starts the registry by providing the required services.
*/
start(instantiationService: IInstantiationService, lifecycleService: ILifecycleService): void;
start(accessor: ServicesAccessor): void;
}
class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry {
private instantiationService: IInstantiationService;
private lifecycleService: ILifecycleService;
private toBeInstantiated: Map<LifecyclePhase, IConstructorSignature0<IWorkbenchContribution>[]> = new Map<LifecyclePhase, IConstructorSignature0<IWorkbenchContribution>[]>();
private readonly toBeInstantiated: Map<LifecyclePhase, IConstructorSignature0<IWorkbenchContribution>[]> = new Map<LifecyclePhase, IConstructorSignature0<IWorkbenchContribution>[]>();
registerWorkbenchContribution(ctor: IWorkbenchContributionSignature, phase: LifecyclePhase = LifecyclePhase.Starting): void {
@@ -63,12 +62,12 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
}
}
start(instantiationService: IInstantiationService, lifecycleService: ILifecycleService): void {
this.instantiationService = instantiationService;
this.lifecycleService = lifecycleService;
start(accessor: ServicesAccessor): void {
this.instantiationService = accessor.get(IInstantiationService);
this.lifecycleService = accessor.get(ILifecycleService);
[LifecyclePhase.Starting, LifecyclePhase.Ready, LifecyclePhase.Restored, LifecyclePhase.Eventually].forEach(phase => {
this.instantiateByPhase(instantiationService, lifecycleService, phase);
this.instantiateByPhase(this.instantiationService, this.lifecycleService, phase);
});
}

View File

@@ -10,12 +10,12 @@ import { URI } from 'vs/base/common/uri';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon';
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput } from 'vs/platform/editor/common/editor';
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { Registry } from 'vs/platform/registry/common/platform';
import { ITextModel } from 'vs/editor/common/model';
import { Schemas } from 'vs/base/common/network';
import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { ICompositeControl } from 'vs/workbench/common/composite';
import { ActionRunner, IAction } from 'vs/base/common/actions';
@@ -142,7 +142,7 @@ export interface IEditorControl extends ICompositeControl { }
export interface IFileInputFactory {
createFileInput(resource: URI, encoding: string, instantiationService: IInstantiationService): IFileEditorInput;
createFileInput(resource: URI, encoding: string | undefined, instantiationService: IInstantiationService): IFileEditorInput;
isFileInput(obj: any): obj is IFileEditorInput;
}
@@ -175,7 +175,10 @@ export interface IEditorInputFactoryRegistry {
*/
getEditorInputFactory(editorInputId: string): IEditorInputFactory;
setInstantiationService(service: IInstantiationService): void;
/**
* Starts the registry by providing the required services.
*/
start(accessor: ServicesAccessor): void;
}
export interface IEditorInputFactory {
@@ -184,13 +187,13 @@ export interface IEditorInputFactory {
* Returns a string representation of the provided editor input that contains enough information
* to deserialize back to the original editor input from the deserialize() method.
*/
serialize(editorInput: EditorInput): string;
serialize(editorInput: EditorInput): string | null;
/**
* Returns an editor input from the provided serialized form of the editor input. This form matches
* the value returned from the serialize() method.
*/
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput;
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | null;
}
export interface IUntitledResourceInput extends IBaseResourceInput {
@@ -541,7 +544,12 @@ export class SideBySideEditorInput extends EditorInput {
static readonly ID: string = 'workbench.editorinputs.sidebysideEditorInput';
constructor(private name: string, private description: string, private _details: EditorInput, private _master: EditorInput) {
constructor(
private readonly name: string,
private readonly description: string | null,
private readonly _details: EditorInput,
private readonly _master: EditorInput
) {
super();
this.registerListeners();
@@ -573,6 +581,7 @@ export class SideBySideEditorInput extends EditorInput {
getTelemetryDescriptor(): object {
const descriptor = this.master.getTelemetryDescriptor();
return objects.assign(descriptor, super.getTelemetryDescriptor());
}
@@ -610,7 +619,7 @@ export class SideBySideEditorInput extends EditorInput {
return this.name;
}
getDescription(): string {
getDescription(): string | null {
return this.description;
}
@@ -649,7 +658,7 @@ export class EditorModel extends Disposable implements IEditorModel {
/**
* Causes this model to load returning a promise when loading is completed.
*/
load(): Promise<EditorModel> {
load(): Promise<IEditorModel> {
return Promise.resolve(this);
}
@@ -699,6 +708,7 @@ export class EditorOptions implements IEditorOptions {
options.pinned = settings.pinned;
options.index = settings.index;
options.inactive = settings.inactive;
options.ignoreError = settings.ignoreError;
return options;
}
@@ -742,6 +752,12 @@ export class EditorOptions implements IEditorOptions {
* in the background.
*/
inactive: boolean | undefined;
/**
* Will not show an error in case opening the editor fails and thus allows to show a custom error
* message as needed. By default, an error will be presented as notification if opening was not possible.
*/
ignoreError: boolean | undefined;
}
/**
@@ -756,9 +772,9 @@ export class TextEditorOptions extends EditorOptions {
private revealInCenterIfOutsideViewport: boolean;
private editorViewState: IEditorViewState | null;
static from(input?: IBaseResourceInput): TextEditorOptions | null {
static from(input?: IBaseResourceInput): TextEditorOptions | undefined {
if (!input || !input.options) {
return null;
return undefined;
}
return TextEditorOptions.create(input.options);
@@ -807,6 +823,10 @@ export class TextEditorOptions extends EditorOptions {
textEditorOptions.inactive = true;
}
if (options.ignoreError) {
textEditorOptions.ignoreError = true;
}
if (typeof options.index === 'number') {
textEditorOptions.index = options.index;
}
@@ -942,12 +962,12 @@ export type GroupIdentifier = number;
export interface IWorkbenchEditorConfiguration {
workbench: {
editor: IWorkbenchEditorPartConfiguration,
editor: IEditorPartConfiguration,
iconTheme: string;
};
}
export interface IWorkbenchEditorPartConfiguration {
interface IEditorPartConfiguration {
showTabs?: boolean;
highlightModifiedTabs?: boolean;
tabCloseButton?: 'left' | 'right' | 'off';
@@ -966,12 +986,16 @@ export interface IWorkbenchEditorPartConfiguration {
restoreViewState?: boolean;
}
export interface IEditorPartOptions extends IEditorPartConfiguration {
iconTheme?: string;
}
export interface IResourceOptions {
supportSideBySide?: boolean;
filter?: string | string[];
}
export function toResource(editor: IEditorInput, options?: IResourceOptions): URI | null {
export function toResource(editor: IEditorInput | null | undefined, options?: IResourceOptions): URI | null {
if (!editor) {
return null;
}
@@ -1032,17 +1056,17 @@ class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
private instantiationService: IInstantiationService;
private fileInputFactory: IFileInputFactory;
private editorInputFactoryConstructors: { [editorInputId: string]: IConstructorSignature0<IEditorInputFactory> } = Object.create(null);
private editorInputFactoryInstances: { [editorInputId: string]: IEditorInputFactory } = Object.create(null);
private readonly editorInputFactoryInstances: { [editorInputId: string]: IEditorInputFactory } = Object.create(null);
setInstantiationService(service: IInstantiationService): void {
this.instantiationService = service;
start(accessor: ServicesAccessor): void {
this.instantiationService = accessor.get(IInstantiationService);
for (let key in this.editorInputFactoryConstructors) {
const element = this.editorInputFactoryConstructors[key];
this.createEditorInputFactory(key, element);
}
this.editorInputFactoryConstructors = {};
this.editorInputFactoryConstructors = Object.create(null);
}
private createEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {

View File

@@ -13,15 +13,13 @@ import { DataUri } from 'vs/base/common/resources';
* An editor model that just represents a resource that can be loaded.
*/
export class BinaryEditorModel extends EditorModel {
private name: string;
private resource: URI;
private size: number;
private etag: string;
private mime: string;
private etag: string | undefined;
private readonly mime: string;
constructor(
resource: URI,
name: string,
private readonly resource: URI,
private readonly name: string,
@IFileService private readonly fileService: IFileService
) {
super();
@@ -70,7 +68,7 @@ export class BinaryEditorModel extends EditorModel {
/**
* The etag of the binary resource if known.
*/
getETag(): string {
getETag(): string | undefined {
return this.etag;
}

View File

@@ -17,14 +17,10 @@ export class DataUriEditorInput extends EditorInput {
static readonly ID: string = 'workbench.editors.dataUriEditorInput';
private resource: URI;
private readonly name: string | undefined;
private readonly description: string | undefined;
constructor(
name: string,
description: string,
resource: URI,
private readonly name: string | undefined,
private readonly description: string | undefined,
private readonly resource: URI,
@IInstantiationService private readonly instantiationService: IInstantiationService
) {
super();

View File

@@ -16,9 +16,9 @@ export class DiffEditorInput extends SideBySideEditorInput {
static readonly ID = 'workbench.editors.diffEditorInput';
private cachedModel: DiffEditorModel;
private cachedModel: DiffEditorModel | null;
constructor(name: string, description: string, original: EditorInput, modified: EditorInput, private forceOpenAsBinary?: boolean) {
constructor(name: string, description: string | null, original: EditorInput, modified: EditorInput, private readonly forceOpenAsBinary?: boolean) {
super(name, description, original, modified);
}

View File

@@ -11,33 +11,39 @@ import { IEditorModel } from 'vs/platform/editor/common/editor';
* and the modified version.
*/
export class DiffEditorModel extends EditorModel {
protected _originalModel: IEditorModel;
protected _modifiedModel: IEditorModel;
protected readonly _originalModel: IEditorModel | null;
protected readonly _modifiedModel: IEditorModel | null;
constructor(originalModel: IEditorModel, modifiedModel: IEditorModel) {
constructor(originalModel: IEditorModel | null, modifiedModel: IEditorModel | null) {
super();
this._originalModel = originalModel;
this._modifiedModel = modifiedModel;
}
get originalModel(): EditorModel {
get originalModel(): EditorModel | null {
if (!this._originalModel) {
return null;
}
return this._originalModel as EditorModel;
}
get modifiedModel(): EditorModel {
get modifiedModel(): EditorModel | null {
if (!this._modifiedModel) {
return null;
}
return this._modifiedModel as EditorModel;
}
load(): Promise<EditorModel> {
return Promise.all([
this._originalModel.load(),
this._modifiedModel.load()
this._originalModel ? this._originalModel.load() : Promise.resolve(undefined),
this._modifiedModel ? this._modifiedModel.load() : Promise.resolve(undefined),
]).then(() => this);
}
isResolved(): boolean {
return this.originalModel.isResolved() && this.modifiedModel.isResolved();
return !!this.originalModel && this.originalModel.isResolved() && !!this.modifiedModel && this.modifiedModel.isResolved();
}
dispose(): void {

View File

@@ -710,7 +710,7 @@ export class EditorGroup extends Disposable {
this.editors = coalesce(data.editors.map(e => {
const factory = registry.getEditorInputFactory(e.id);
if (factory) {
const editor = factory.deserialize(this.instantiationService, e.value);
const editor = factory.deserialize(this.instantiationService, e.value)!;
this.registerEditorListeners(editor);
this.updateResourceMap(editor, false /* add */);

View File

@@ -6,10 +6,8 @@
import { EditorInput, ITextEditorModel } from 'vs/workbench/common/editor';
import { URI } from 'vs/base/common/uri';
import { IReference } from 'vs/base/common/lifecycle';
import { telemetryURIDescriptor } from 'vs/platform/telemetry/common/telemetryUtils';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
/**
* A read-only text editor input whos contents are made of the provided resource that points to an existing
@@ -19,17 +17,13 @@ export class ResourceEditorInput extends EditorInput {
static readonly ID: string = 'workbench.editors.resourceEditorInput';
private modelReference: Promise<IReference<ITextEditorModel>>;
private resource: URI;
private name: string;
private description: string;
private modelReference: Promise<IReference<ITextEditorModel>> | null;
constructor(
name: string,
description: string,
resource: URI,
@ITextModelService private readonly textModelResolverService: ITextModelService,
@IHashService private readonly hashService: IHashService
private name: string,
private description: string | null,
private readonly resource: URI,
@ITextModelService private readonly textModelResolverService: ITextModelService
) {
super();
@@ -57,7 +51,7 @@ export class ResourceEditorInput extends EditorInput {
}
}
getDescription(): string {
getDescription(): string | null {
return this.description;
}
@@ -68,18 +62,6 @@ export class ResourceEditorInput extends EditorInput {
}
}
getTelemetryDescriptor(): object {
const descriptor = super.getTelemetryDescriptor();
descriptor['resource'] = telemetryURIDescriptor(this.resource, path => this.hashService.createSHA1(path));
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"resource": { "${inline}": [ "${URIDescriptor}" ] }
}
*/
return descriptor;
}
resolve(): Promise<ITextEditorModel> {
if (!this.modelReference) {
this.modelReference = this.textModelResolverService.createModelReference(this.resource);
@@ -92,7 +74,7 @@ export class ResourceEditorInput extends EditorInput {
ref.dispose();
this.modelReference = null;
return Promise.reject(new Error(`Unexpected model for ResourceInput: ${this.resource}`));
return Promise.reject<any>(new Error(`Unexpected model for ResourceInput: ${this.resource}`));
}
return model;

View File

@@ -13,7 +13,7 @@ import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel';
* and the modified version.
*/
export class TextDiffEditorModel extends DiffEditorModel {
private _textDiffEditorModel: IDiffEditorModel;
private _textDiffEditorModel: IDiffEditorModel | null;
constructor(originalModel: BaseTextEditorModel, modifiedModel: BaseTextEditorModel) {
super(originalModel, modifiedModel);
@@ -56,7 +56,7 @@ export class TextDiffEditorModel extends DiffEditorModel {
}
}
get textDiffEditorModel(): IDiffEditorModel {
get textDiffEditorModel(): IDiffEditorModel | null {
return this._textDiffEditorModel;
}

View File

@@ -6,7 +6,7 @@
import { ITextModel, ITextBufferFactory } from 'vs/editor/common/model';
import { EditorModel } from 'vs/workbench/common/editor';
import { URI } from 'vs/base/common/uri';
import { ITextEditorModel } from 'vs/editor/common/services/resolverService';
import { ITextEditorModel, IResolvedTextEditorModel } from 'vs/editor/common/services/resolverService';
import { IModeService, ILanguageSelection } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -19,8 +19,8 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
protected createdEditorModel: boolean;
private textEditorModelHandle: URI;
private modelDisposeListener: IDisposable;
private textEditorModelHandle: URI | null;
private modelDisposeListener: IDisposable | null;
constructor(
@IModelService protected modelService: IModelService,
@@ -59,7 +59,7 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
});
}
get textEditorModel(): ITextModel {
get textEditorModel(): ITextModel | null {
return this.textEditorModelHandle ? this.modelService.getModel(this.textEditorModelHandle) : null;
}
@@ -68,14 +68,14 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
/**
* Creates the text editor model with the provided value, modeId (can be comma separated for multiple values) and optional resource URL.
*/
protected createTextEditorModel(value: ITextBufferFactory, resource?: URI, modeId?: string): EditorModel {
protected createTextEditorModel(value: ITextBufferFactory, resource: URI | undefined, modeId?: string): EditorModel {
const firstLineText = this.getFirstLineText(value);
const languageSelection = this.getOrCreateMode(this.modeService, modeId, firstLineText);
return this.doCreateTextEditorModel(value, languageSelection, resource);
}
private doCreateTextEditorModel(value: ITextBufferFactory, languageSelection: ILanguageSelection, resource: URI): EditorModel {
private doCreateTextEditorModel(value: ITextBufferFactory, languageSelection: ILanguageSelection, resource: URI | undefined): EditorModel {
let model = resource && this.modelService.getModel(resource);
if (!model) {
model = this.modelService.createModel(value, languageSelection, resource);
@@ -111,7 +111,7 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
*
* @param firstLineText optional first line of the text buffer to set the mode on. This can be used to guess a mode from content.
*/
protected getOrCreateMode(modeService: IModeService, modeId: string, firstLineText?: string): ILanguageSelection {
protected getOrCreateMode(modeService: IModeService, modeId: string | undefined, firstLineText?: string): ILanguageSelection {
return modeService.create(modeId);
}
@@ -126,7 +126,7 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
this.modelService.updateModel(this.textEditorModel, newValue);
}
createSnapshot(): ITextSnapshot {
createSnapshot(): ITextSnapshot | null {
const model = this.textEditorModel;
if (model) {
return model.createSnapshot(true /* Preserve BOM */);
@@ -135,7 +135,7 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
return null;
}
isResolved(): boolean {
isResolved(): this is IResolvedTextEditorModel {
return !!this.textEditorModelHandle;
}

View File

@@ -7,16 +7,15 @@ import { URI } from 'vs/base/common/uri';
import { suggestFilename } from 'vs/base/common/mime';
import { memoize } from 'vs/base/common/decorators';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import * as paths from 'vs/base/common/paths';
import * as resources from 'vs/base/common/resources';
import { basename } from 'vs/base/common/path';
import { basenameOrAuthority, dirname } from 'vs/base/common/resources';
import { EditorInput, IEncodingSupport, EncodingMode, ConfirmResult, Verbosity } from 'vs/workbench/common/editor';
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Event, Emitter } from 'vs/base/common/event';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { telemetryURIDescriptor } from 'vs/platform/telemetry/common/telemetryUtils';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { ILabelService } from 'vs/platform/label/common/label';
import { IResolvedTextEditorModel } from 'vs/editor/common/services/resolverService';
/**
* An editor input to be used for untitled text buffers.
@@ -25,9 +24,8 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
static readonly ID: string = 'workbench.editors.untitledEditorInput';
private _hasAssociatedFilePath: boolean;
private cachedModel: UntitledEditorModel;
private modelResolve: Promise<UntitledEditorModel>;
private modelResolve?: Promise<UntitledEditorModel & IResolvedTextEditorModel>;
private readonly _onDidModelChangeContent: Emitter<void> = this._register(new Emitter<void>());
get onDidModelChangeContent(): Event<void> { return this._onDidModelChangeContent.event; }
@@ -36,19 +34,16 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
get onDidModelChangeEncoding(): Event<void> { return this._onDidModelChangeEncoding.event; }
constructor(
private resource: URI,
hasAssociatedFilePath: boolean,
private modeId: string,
private initialValue: string,
private readonly resource: URI,
private readonly _hasAssociatedFilePath: boolean,
private readonly modeId: string,
private readonly initialValue: string,
private preferredEncoding: string,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ITextFileService private readonly textFileService: ITextFileService,
@IHashService private readonly hashService: IHashService,
@ILabelService private readonly labelService: ILabelService
) {
super();
this._hasAssociatedFilePath = hasAssociatedFilePath;
}
get hasAssociatedFilePath(): boolean {
@@ -63,7 +58,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return this.resource;
}
getModeId(): string {
getModeId(): string | null {
if (this.cachedModel) {
return this.cachedModel.getModeId();
}
@@ -72,44 +67,38 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
}
getName(): string {
return this.hasAssociatedFilePath ? resources.basenameOrAuthority(this.resource) : this.resource.path;
return this.hasAssociatedFilePath ? basenameOrAuthority(this.resource) : this.resource.path;
}
@memoize
private get shortDescription(): string {
return paths.basename(this.labelService.getUriLabel(resources.dirname(this.resource)));
return basename(this.labelService.getUriLabel(dirname(this.resource)));
}
@memoize
private get mediumDescription(): string {
return this.labelService.getUriLabel(resources.dirname(this.resource), { relative: true });
return this.labelService.getUriLabel(dirname(this.resource), { relative: true });
}
@memoize
private get longDescription(): string {
return this.labelService.getUriLabel(resources.dirname(this.resource));
return this.labelService.getUriLabel(dirname(this.resource));
}
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string {
getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string | null {
if (!this.hasAssociatedFilePath) {
return null;
}
let description: string;
switch (verbosity) {
case Verbosity.SHORT:
description = this.shortDescription;
break;
return this.shortDescription;
case Verbosity.LONG:
description = this.longDescription;
break;
return this.longDescription;
case Verbosity.MEDIUM:
default:
description = this.mediumDescription;
break;
return this.mediumDescription;
}
return description;
}
@memoize
@@ -127,25 +116,21 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return this.labelService.getUriLabel(this.resource);
}
getTitle(verbosity: Verbosity): string {
getTitle(verbosity: Verbosity): string | null {
if (!this.hasAssociatedFilePath) {
return this.getName();
}
let title: string;
switch (verbosity) {
case Verbosity.SHORT:
title = this.shortTitle;
break;
return this.shortTitle;
case Verbosity.MEDIUM:
title = this.mediumTitle;
break;
return this.mediumTitle;
case Verbosity.LONG:
title = this.longTitle;
break;
return this.longTitle;
}
return title;
return null;
}
isDirty(): boolean {
@@ -214,7 +199,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
}
}
resolve(): Promise<UntitledEditorModel> {
resolve(): Promise<UntitledEditorModel & IResolvedTextEditorModel> {
// Join a model resolve if we have had one before
if (this.modelResolve) {
@@ -239,18 +224,6 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return model;
}
getTelemetryDescriptor(): object {
const descriptor = super.getTelemetryDescriptor();
descriptor['resource'] = telemetryURIDescriptor(this.getResource(), path => this.hashService.createSHA1(path));
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"resource": { "${inline}": [ "${URIDescriptor}" ] }
}
*/
return descriptor;
}
matches(otherInput: any): boolean {
if (super.matches(otherInput) === true) {
return true;

View File

@@ -16,6 +16,7 @@ import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextBufferFactory } from 'vs/editor/common/model';
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
import { IResolvedTextEditorModel } from 'vs/editor/common/services/resolverService';
export class UntitledEditorModel extends BaseTextEditorModel implements IEncodingSupport {
@@ -30,16 +31,16 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
private readonly _onDidChangeEncoding: Emitter<void> = this._register(new Emitter<void>());
get onDidChangeEncoding(): Event<void> { return this._onDidChangeEncoding.event; }
private dirty: boolean;
private versionId: number;
private contentChangeEventScheduler: RunOnceScheduler;
private dirty: boolean = false;
private versionId: number = 0;
private readonly contentChangeEventScheduler: RunOnceScheduler;
private configuredEncoding: string;
constructor(
private modeId: string,
private resource: URI,
private hasAssociatedFilePath: boolean,
private initialValue: string,
private readonly modeId: string,
private readonly resource: URI,
private _hasAssociatedFilePath: boolean,
private readonly initialValue: string,
private preferredEncoding: string,
@IModeService modeService: IModeService,
@IModelService modelService: IModelService,
@@ -48,14 +49,15 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
) {
super(modelService, modeService);
this.dirty = false;
this.versionId = 0;
this.contentChangeEventScheduler = this._register(new RunOnceScheduler(() => this._onDidChangeContent.fire(), UntitledEditorModel.DEFAULT_CONTENT_CHANGE_BUFFER_DELAY));
this.registerListeners();
}
get hasAssociatedFilePath(): boolean {
return this._hasAssociatedFilePath;
}
protected getOrCreateMode(modeService: IModeService, modeId: string, firstLineText?: string): ILanguageSelection {
if (!modeId || modeId === PLAINTEXT_MODE_ID) {
return modeService.createByFilepathOrFirstLine(this.resource.fsPath, firstLineText); // lookup mode via resource path if the provided modeId is unspecific
@@ -86,12 +88,12 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
return this.versionId;
}
getModeId(): string {
getModeId(): string | null {
if (this.textEditorModel) {
return this.textEditorModel.getLanguageIdentifier().language;
}
return null;
return this.modeId;
}
getEncoding(): string {
@@ -134,20 +136,20 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
this.contentChangeEventScheduler.schedule();
}
load(): Promise<UntitledEditorModel> {
load(): Promise<UntitledEditorModel & IResolvedTextEditorModel> {
// Check for backups first
return this.backupFileService.loadBackupResource(this.resource).then(backupResource => {
return this.backupFileService.loadBackupResource(this.resource).then((backupResource) => {
if (backupResource) {
return this.backupFileService.resolveBackupContent(backupResource);
}
return null;
return undefined;
}).then(backupTextBufferFactory => {
const hasBackup = !!backupTextBufferFactory;
// untitled associated to file path are dirty right away as well as untitled with content
this.setDirty(this.hasAssociatedFilePath || hasBackup);
this.setDirty(this._hasAssociatedFilePath || hasBackup);
let untitledContents: ITextBufferFactory;
if (backupTextBufferFactory) {
@@ -169,22 +171,29 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
// Encoding
this.configuredEncoding = this.configurationService.getValue<string>(this.resource, 'files.encoding');
// We know for a fact there is a text editor model here
const textEditorModel = this.textEditorModel!;
// Listen to content changes
this._register(this.textEditorModel.onDidChangeContent(() => this.onModelContentChanged()));
this._register(textEditorModel.onDidChangeContent(() => this.onModelContentChanged()));
// Listen to mode changes
this._register(this.textEditorModel.onDidChangeLanguage(() => this.onConfigurationChange())); // mode change can have impact on config
this._register(textEditorModel.onDidChangeLanguage(() => this.onConfigurationChange())); // mode change can have impact on config
return this;
return this as UntitledEditorModel & IResolvedTextEditorModel;
});
}
private onModelContentChanged(): void {
if (!this.isResolved()) {
return;
}
this.versionId++;
// mark the untitled editor as non-dirty once its content becomes empty and we do
// not have an associated path set. we never want dirty indicator in that case.
if (!this.hasAssociatedFilePath && this.textEditorModel.getLineCount() === 1 && this.textEditorModel.getLineContent(1) === '') {
if (!this._hasAssociatedFilePath && this.textEditorModel && this.textEditorModel.getLineCount() === 1 && this.textEditorModel.getLineContent(1) === '') {
this.setDirty(false);
}

View File

@@ -1,35 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export const enum MessageType {
Initialized,
Ready,
Terminate
}
export function createMessageOfType(type: MessageType): Buffer {
const result = Buffer.allocUnsafe(1);
switch (type) {
case MessageType.Initialized: result.writeUInt8(1, 0); break;
case MessageType.Ready: result.writeUInt8(2, 0); break;
case MessageType.Terminate: result.writeUInt8(3, 0); break;
}
return result;
}
export function isMessageOfType(message: Buffer, type: MessageType): boolean {
if (message.length !== 1) {
return false;
}
switch (message.readUInt8(0)) {
case 1: return type === MessageType.Initialized;
case 2: return type === MessageType.Ready;
case 3: return type === MessageType.Terminate;
default: return false;
}
}

View File

@@ -13,7 +13,7 @@ export class Memento {
private static readonly COMMON_PREFIX = 'memento/';
private id: string;
private readonly id: string;
constructor(id: string, private storageService: IStorageService) {
this.id = Memento.COMMON_PREFIX + id;
@@ -59,7 +59,7 @@ export class Memento {
}
class ScopedMemento {
private mementoObj: object;
private readonly mementoObj: object;
constructor(private id: string, private scope: StorageScope, private storageService: IStorageService) {
this.mementoObj = this.load();

View File

@@ -48,7 +48,7 @@ export class NotificationHandle implements INotificationHandle {
private readonly _onDidClose: Emitter<void> = new Emitter();
get onDidClose(): Event<void> { return this._onDidClose.event; }
constructor(private item: INotificationViewItem, private closeItem: (item: INotificationViewItem) => void) {
constructor(private readonly item: INotificationViewItem, private readonly closeItem: (item: INotificationViewItem) => void) {
this.registerListeners();
}
@@ -88,7 +88,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
private readonly _onDidNotificationChange: Emitter<INotificationChangeEvent> = this._register(new Emitter<INotificationChangeEvent>());
get onDidNotificationChange(): Event<INotificationChangeEvent> { return this._onDidNotificationChange.event; }
private _notifications: INotificationViewItem[] = [];
private readonly _notifications: INotificationViewItem[] = [];
get notifications(): INotificationViewItem[] {
return this._notifications;
@@ -235,7 +235,7 @@ export interface INotificationViewItemProgress extends INotificationProgress {
}
export class NotificationViewItemProgress extends Disposable implements INotificationViewItemProgress {
private _state: INotificationViewItemProgressState;
private readonly _state: INotificationViewItemProgressState;
private readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());
get onDidChange(): Event<void> { return this._onDidChange.event; }
@@ -580,10 +580,10 @@ export class NotificationViewItem extends Disposable implements INotificationVie
export class ChoiceAction extends Action {
private _onDidRun = new Emitter<void>();
private readonly _onDidRun = new Emitter<void>();
get onDidRun(): Event<void> { return this._onDidRun.event; }
private _keepOpen: boolean;
private readonly _keepOpen: boolean;
constructor(id: string, choice: IPromptChoice) {
super(id, choice.label, undefined, true, () => {

View File

@@ -4,5 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { IComposite } from 'vs/workbench/common/composite';
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export const ActivePanelContext = new RawContextKey<string>('activePanel', '');
export const PanelFocusContext = new RawContextKey<boolean>('panelFocus', false);
export interface IPanel extends IComposite { }

View File

@@ -4,11 +4,17 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import * as paths from 'vs/base/common/paths';
import * as objects from 'vs/base/common/objects';
import { Event, Emitter } from 'vs/base/common/event';
import { basename, extname, relativePath } from 'vs/base/common/resources';
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IFileService } from 'vs/platform/files/common/files';
import { Disposable } from 'vs/base/common/lifecycle';
import { ParsedExpression, IExpression, parse } from 'vs/base/common/glob';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { withNullAsUndefined } from 'vs/base/common/types';
export class ResourceContextKey extends Disposable implements IContextKey<URI> {
@@ -20,11 +26,11 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
static HasResource = new RawContextKey<boolean>('resourceSet', false);
static IsFileSystemResource = new RawContextKey<boolean>('isFileSystemResource', false);
private readonly _resourceKey: IContextKey<URI>;
private readonly _schemeKey: IContextKey<string>;
private readonly _filenameKey: IContextKey<string>;
private readonly _resourceKey: IContextKey<URI | null>;
private readonly _schemeKey: IContextKey<string | null>;
private readonly _filenameKey: IContextKey<string | null>;
private readonly _langIdKey: IContextKey<string | null>;
private readonly _extensionKey: IContextKey<string>;
private readonly _extensionKey: IContextKey<string | null>;
private readonly _hasResource: IContextKey<boolean>;
private readonly _isFileSystemResource: IContextKey<boolean>;
@@ -54,15 +60,15 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
}));
}
set(value: URI) {
set(value: URI | null) {
if (!ResourceContextKey._uriEquals(this._resourceKey.get(), value)) {
this._resourceKey.set(value);
this._schemeKey.set(value && value.scheme);
this._filenameKey.set(value && paths.basename(value.fsPath));
this._schemeKey.set(value ? value.scheme : null);
this._filenameKey.set(value ? basename(value) : null);
this._langIdKey.set(value ? this._modeService.getModeIdByFilepathOrFirstLine(value.fsPath) : null);
this._extensionKey.set(value && paths.extname(value.fsPath));
this._extensionKey.set(value ? extname(value) : null);
this._hasResource.set(!!value);
this._isFileSystemResource.set(value && this._fileService.canHandleResource(value));
this._isFileSystemResource.set(value ? this._fileService.canHandleResource(value) : false);
}
}
@@ -77,7 +83,7 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
}
get(): URI | undefined {
return this._resourceKey.get();
return withNullAsUndefined(this._resourceKey.get());
}
private static _uriEquals(a: URI | undefined | null, b: URI | undefined | null): boolean {
@@ -95,3 +101,103 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
&& a.toString() === b.toString(); // for equal we use the normalized toString-form
}
}
export class ResourceGlobMatcher extends Disposable {
private static readonly NO_ROOT: string | null = null;
private readonly _onExpressionChange: Emitter<void> = this._register(new Emitter<void>());
get onExpressionChange(): Event<void> { return this._onExpressionChange.event; }
private readonly mapRootToParsedExpression: Map<string | null, ParsedExpression> = new Map<string, ParsedExpression>();
private readonly mapRootToExpressionConfig: Map<string | null, IExpression> = new Map<string, IExpression>();
constructor(
private globFn: (root?: URI) => IExpression,
private shouldUpdate: (event: IConfigurationChangeEvent) => boolean,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super();
this.updateExcludes(false);
this.registerListeners();
}
private registerListeners(): void {
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (this.shouldUpdate(e)) {
this.updateExcludes(true);
}
}));
this._register(this.contextService.onDidChangeWorkspaceFolders(() => this.updateExcludes(true)));
}
private updateExcludes(fromEvent: boolean): void {
let changed = false;
// Add excludes per workspaces that got added
this.contextService.getWorkspace().folders.forEach(folder => {
const rootExcludes = this.globFn(folder.uri);
if (!this.mapRootToExpressionConfig.has(folder.uri.toString()) || !objects.equals(this.mapRootToExpressionConfig.get(folder.uri.toString()), rootExcludes)) {
changed = true;
this.mapRootToParsedExpression.set(folder.uri.toString(), parse(rootExcludes));
this.mapRootToExpressionConfig.set(folder.uri.toString(), objects.deepClone(rootExcludes));
}
});
// Remove excludes per workspace no longer present
this.mapRootToExpressionConfig.forEach((value, root) => {
if (root === ResourceGlobMatcher.NO_ROOT) {
return; // always keep this one
}
if (root && !this.contextService.getWorkspaceFolder(URI.parse(root))) {
this.mapRootToParsedExpression.delete(root);
this.mapRootToExpressionConfig.delete(root);
changed = true;
}
});
// Always set for resources outside root as well
const globalExcludes = this.globFn();
if (!this.mapRootToExpressionConfig.has(ResourceGlobMatcher.NO_ROOT) || !objects.equals(this.mapRootToExpressionConfig.get(ResourceGlobMatcher.NO_ROOT), globalExcludes)) {
changed = true;
this.mapRootToParsedExpression.set(ResourceGlobMatcher.NO_ROOT, parse(globalExcludes));
this.mapRootToExpressionConfig.set(ResourceGlobMatcher.NO_ROOT, objects.deepClone(globalExcludes));
}
if (fromEvent && changed) {
this._onExpressionChange.fire();
}
}
matches(resource: URI): boolean {
const folder = this.contextService.getWorkspaceFolder(resource);
let expressionForRoot: ParsedExpression;
if (folder && this.mapRootToParsedExpression.has(folder.uri.toString())) {
expressionForRoot = this.mapRootToParsedExpression.get(folder.uri.toString())!;
} else {
expressionForRoot = this.mapRootToParsedExpression.get(ResourceGlobMatcher.NO_ROOT)!;
}
// If the resource if from a workspace, convert its absolute path to a relative
// path so that glob patterns have a higher probability to match. For example
// a glob pattern of "src/**" will not match on an absolute path "/folder/src/file.txt"
// but can match on "src/file.txt"
let resourcePathToMatch: string;
if (folder) {
resourcePathToMatch = relativePath(folder.uri, resource)!; // always uses forward slashes
} else {
resourcePathToMatch = resource.fsPath; // TODO@isidor: support non-file URIs
}
return !!expressionForRoot(resourcePathToMatch);
}
}

View File

@@ -378,8 +378,8 @@ export const SIDE_BAR_TITLE_FOREGROUND = registerColor('sideBarTitle.foreground'
export const SIDE_BAR_DRAG_AND_DROP_BACKGROUND = registerColor('sideBar.dropBackground', {
dark: Color.white.transparent(0.12),
light: Color.white.transparent(0.12),
hc: Color.white.transparent(0.12),
light: Color.black.transparent(0.1),
hc: Color.white.transparent(0.3),
}, nls.localize('sideBarDragAndDropBackground', "Drag and drop feedback color for the side bar sections. The color should have transparency so that the side bar sections can still shine through. The side bar is the container for views like explorer and search."));
export const SIDE_BAR_SECTION_HEADER_BACKGROUND = registerColor('sideBarSectionHeader.background', {

View File

@@ -4,6 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import { IComposite } from 'vs/workbench/common/composite';
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export const SidebarVisibleContext = new RawContextKey<boolean>('sidebarVisible', false);
export const SideBarVisibleContext = new RawContextKey<boolean>('sideBarVisible', false);
export const SidebarFocusContext = new RawContextKey<boolean>('sideBarFocus', false);
export const ActiveViewletContext = new RawContextKey<string>('activeViewlet', '');
export interface IViewlet extends IComposite {

View File

@@ -10,7 +10,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ITreeViewDataProvider } from 'vs/workbench/common/views';
import { localize } from 'vs/nls';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable } from 'vs/base/common/lifecycle';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { values, keys } from 'vs/base/common/map';
@@ -24,6 +24,7 @@ export const TEST_VIEW_CONTAINER_ID = 'workbench.view.extension.test';
export namespace Extensions {
export const ViewContainersRegistry = 'workbench.registry.view.containers';
export const ViewsRegistry = 'workbench.registry.view';
}
export interface IViewContainersRegistry {
@@ -50,7 +51,7 @@ export interface IViewContainersRegistry {
*
* @returns the registered ViewContainer.
*/
registerViewContainer(id: string, extensionId?: ExtensionIdentifier): ViewContainer;
registerViewContainer(id: string, hideIfEmpty?: boolean, extensionId?: ExtensionIdentifier): ViewContainer;
/**
* Deregisters the given view container
@@ -67,7 +68,7 @@ export interface IViewContainersRegistry {
}
export class ViewContainer {
protected constructor(readonly id: string, readonly extensionId: ExtensionIdentifier) { }
protected constructor(readonly id: string, readonly hideIfEmpty: boolean, readonly extensionId?: ExtensionIdentifier) { }
}
class ViewContainersRegistryImpl implements IViewContainersRegistry {
@@ -84,7 +85,7 @@ class ViewContainersRegistryImpl implements IViewContainersRegistry {
return values(this.viewContainers);
}
registerViewContainer(id: string, extensionId: ExtensionIdentifier): ViewContainer {
registerViewContainer(id: string, hideIfEmpty?: boolean, extensionId?: ExtensionIdentifier): ViewContainer {
const existing = this.viewContainers.get(id);
if (existing) {
return existing;
@@ -92,7 +93,7 @@ class ViewContainersRegistryImpl implements IViewContainersRegistry {
const viewContainer = new class extends ViewContainer {
constructor() {
super(id, extensionId);
super(id, !!hideIfEmpty, extensionId);
}
};
this.viewContainers.set(id, viewContainer);
@@ -121,8 +122,7 @@ export interface IViewDescriptor {
readonly name: string;
// TODO@Sandeep do we really need this?!
readonly ctor: any;
readonly ctorDescriptor: { ctor: any, arguments?: any[] };
readonly when?: ContextKeyExpr;
@@ -137,6 +137,8 @@ export interface IViewDescriptor {
// Applies only to newly created views
readonly hideByDefault?: boolean;
readonly workspace?: boolean;
readonly focusCommand?: { id: string, keybindings?: IKeybindings };
}
@@ -167,7 +169,7 @@ export interface IViewsRegistry {
getViewContainer(id: string): ViewContainer | null;
}
export const ViewsRegistry: IViewsRegistry = new class implements IViewsRegistry {
class ViewsRegistry implements IViewsRegistry {
private readonly _onViewsRegistered: Emitter<{ views: IViewDescriptor[], viewContainer: ViewContainer }> = new Emitter<{ views: IViewDescriptor[], viewContainer: ViewContainer }>();
readonly onViewsRegistered: Event<{ views: IViewDescriptor[], viewContainer: ViewContainer }> = this._onViewsRegistered.event;
@@ -268,7 +270,9 @@ export const ViewsRegistry: IViewsRegistry = new class implements IViewsRegistry
}
return viewsToDeregister;
}
};
}
Registry.add(Extensions.ViewsRegistry, new ViewsRegistry());
export interface IView {
@@ -285,7 +289,7 @@ export interface IViewsViewlet extends IViewlet {
export const IViewsService = createDecorator<IViewsService>('viewsService');
export interface IViewsService {
_serviceBrand: any;
_serviceBrand: ServiceIdentifier<any>;
openView(id: string, focus?: boolean): Promise<IView | null>;
@@ -296,11 +300,11 @@ export interface IViewsService {
export interface ITreeView extends IDisposable {
dataProvider: ITreeViewDataProvider;
dataProvider: ITreeViewDataProvider | null;
showCollapseAllAction: boolean;
message: string | IMarkdownString;
message?: string | IMarkdownString;
readonly visible: boolean;
@@ -322,7 +326,7 @@ export interface ITreeView extends IDisposable {
layout(height: number): void;
show(container: HTMLElement);
show(container: HTMLElement): void;
getOptimalWidth(): number;
@@ -378,7 +382,7 @@ export interface ITreeItem {
handle: string;
parentHandle: string;
parentHandle?: string;
collapsibleState: TreeItemCollapsibleState;