Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -18,6 +18,7 @@ export interface IViewletService {
onDidViewletOpen: Event<IViewlet>;
onDidViewletClose: Event<IViewlet>;
onDidViewletEnablementChange: Event<{ id: string, enabled: boolean }>;
/**
* Opens a viewlet with the given identifier and pass keyboard focus to it if specified.
@@ -40,10 +41,16 @@ export interface IViewletService {
getViewlet(id: string): ViewletDescriptor;
/**
* Returns all registered viewlets
* Returns all enabled viewlets
*/
getViewlets(): ViewletDescriptor[];
/**
* Enables or disables a viewlet. Disabled viewlets are completly hidden from UI.
* By default all viewlets are enabled.
*/
setViewletEnablement(id: string, enabled: boolean): void;
/**
*
*/

View File

@@ -7,12 +7,17 @@
import { TPromise, ValueCallback } from 'vs/base/common/winjs.base';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import Event from 'vs/base/common/event';
import Event, { Emitter } from 'vs/base/common/event';
import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
import { Registry } from 'vs/platform/registry/common/platform';
import { ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions } from 'vs/workbench/browser/viewlet';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
const ActiveViewletContextId = 'activeViewlet';
export const ActiveViewletContext = new RawContextKey<string>(ActiveViewletContextId, '');
export class ViewletService implements IViewletService {
@@ -24,20 +29,42 @@ export class ViewletService implements IViewletService {
private extensionViewlets: ViewletDescriptor[];
private extensionViewletsLoaded: TPromise<void>;
private extensionViewletsLoadedPromiseComplete: ValueCallback;
private activeViewletContextKey: IContextKey<string>;
private _onDidViewletEnable = new Emitter<{ id: string, enabled: boolean }>();
private disposables: IDisposable[] = [];
public get onDidViewletOpen(): Event<IViewlet> { return this.sidebarPart.onDidViewletOpen; }
public get onDidViewletClose(): Event<IViewlet> { return this.sidebarPart.onDidViewletClose; }
public get onDidViewletEnablementChange(): Event<{ id: string, enabled: boolean }> { return this._onDidViewletEnable.event; }
constructor(
sidebarPart: SidebarPart,
@IExtensionService private extensionService: IExtensionService
@IExtensionService private extensionService: IExtensionService,
@IContextKeyService contextKeyService: IContextKeyService
) {
this.sidebarPart = sidebarPart;
this.viewletRegistry = Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets);
this.activeViewletContextKey = ActiveViewletContext.bindTo(contextKeyService);
this.onDidViewletOpen(this._onDidViewletOpen, this, this.disposables);
this.onDidViewletClose(this._onDidViewletClose, this, this.disposables);
this.loadExtensionViewlets();
}
private _onDidViewletOpen(viewlet: IViewlet): void {
this.activeViewletContextKey.set(viewlet.getId());
}
private _onDidViewletClose(viewlet: IViewlet): void {
const id = viewlet.getId();
if (this.activeViewletContextKey.get() === id) {
this.activeViewletContextKey.set('');
}
}
private loadExtensionViewlets(): void {
this.extensionViewlets = [];
@@ -57,6 +84,14 @@ export class ViewletService implements IViewletService {
});
}
public setViewletEnablement(id: string, enabled: boolean): void {
const descriptor = this.getBuiltInViewlets().filter(desc => desc.id === id).pop();
if (descriptor && descriptor.enabled !== enabled) {
descriptor.enabled = enabled;
this._onDidViewletEnable.fire({ id, enabled });
}
}
public openViewlet(id: string, focus?: boolean): TPromise<IViewlet> {
// Built in viewlets do not need to wait for extensions to be loaded
@@ -83,8 +118,9 @@ export class ViewletService implements IViewletService {
public getViewlets(): ViewletDescriptor[] {
const builtInViewlets = this.getBuiltInViewlets();
const viewlets = builtInViewlets.concat(this.extensionViewlets);
return builtInViewlets.concat(this.extensionViewlets);
return viewlets.filter(v => v.enabled);
}
private getBuiltInViewlets(): ViewletDescriptor[] {
@@ -104,4 +140,8 @@ export class ViewletService implements IViewletService {
public getProgressIndicator(id: string): IProgressService {
return this.sidebarPart.getProgressIndicator(id);
}
dispose(): void {
this.disposables = dispose(this.disposables);
}
}