Merge branch 'master' into scm-multiroot

This commit is contained in:
Joao Moreno
2017-08-21 12:09:10 +02:00
359 changed files with 6618 additions and 3656 deletions

View File

@@ -10,12 +10,12 @@ import URI from 'vs/base/common/uri';
import Event, { Emitter } from 'vs/base/common/event';
import { assign } from 'vs/base/common/objects';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ISCMService, ISCMProvider, ISCMResource, ISCMResourceGroup, ISCMResourceDecorations } from 'vs/workbench/services/scm/common/scm';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { ExtHostContext, MainThreadSCMShape, ExtHostSCMShape, SCMProviderFeatures, SCMRawResource, SCMGroupFeatures } from '../node/extHost.protocol';
import { ExtHostContext, MainThreadSCMShape, ExtHostSCMShape, SCMProviderFeatures, SCMRawResource, SCMGroupFeatures, MainContext, IExtHostContext } from '../node/extHost.protocol';
import { Command } from 'vs/editor/common/modes';
import { extHostNamedCustomer } from "vs/workbench/api/electron-browser/extHostCustomers";
class MainThreadSCMResourceGroup implements ISCMResourceGroup {
@@ -156,12 +156,13 @@ class MainThreadSCMProvider implements ISCMProvider {
}
group.resources = resources.map(rawResource => {
const [handle, sourceUri, command, icons, strikeThrough, faded] = rawResource;
const [handle, sourceUri, command, icons, tooltip, strikeThrough, faded] = rawResource;
const icon = icons[0];
const iconDark = icons[1] || icon;
const decorations = {
icon: icon && URI.parse(icon),
iconDark: iconDark && URI.parse(iconDark),
tooltip,
strikeThrough,
faded
};
@@ -211,7 +212,8 @@ class MainThreadSCMProvider implements ISCMProvider {
}
}
export class MainThreadSCM extends MainThreadSCMShape {
@extHostNamedCustomer(MainContext.MainThreadSCM)
export class MainThreadSCM implements MainThreadSCMShape {
private _proxy: ExtHostSCMShape;
private _sourceControls: { [handle: number]: MainThreadSCMProvider; } = Object.create(null);
@@ -219,18 +221,29 @@ export class MainThreadSCM extends MainThreadSCMShape {
private _disposables: IDisposable[] = [];
constructor(
@IThreadService threadService: IThreadService,
extHostContext: IExtHostContext,
@IInstantiationService private instantiationService: IInstantiationService,
@ISCMService private scmService: ISCMService,
@ICommandService private commandService: ICommandService
) {
super();
this._proxy = threadService.get(ExtHostContext.ExtHostSCM);
this._proxy = extHostContext.get(ExtHostContext.ExtHostSCM);
this.scmService.onDidChangeProvider(this.onDidChangeProvider, this, this._disposables);
this.scmService.input.onDidChange(this._proxy.$onInputBoxValueChange, this._proxy, this._disposables);
}
dispose(): void {
Object.keys(this._sourceControls)
.forEach(id => this._sourceControls[id].dispose());
this._sourceControls = Object.create(null);
Object.keys(this._sourceControlDisposables)
.forEach(id => this._sourceControlDisposables[id].dispose());
this._sourceControlDisposables = Object.create(null);
this._disposables = dispose(this._disposables);
}
$registerSourceControl(handle: number, id: string, label: string): void {
const provider = new MainThreadSCMProvider(this._proxy, handle, id, label, this.scmService, this.commandService);
this._sourceControls[handle] = provider;
@@ -319,12 +332,4 @@ export class MainThreadSCM extends MainThreadSCMShape {
const handle = Object.keys(this._sourceControls).filter(handle => this._sourceControls[handle] === provider)[0];
this._proxy.$onActiveSourceControlChange(handle && parseInt(handle));
}
dispose(): void {
Object.keys(this._sourceControls)
.forEach(id => this._sourceControls[id].dispose());
this._sourceControls = Object.create(null);
this._disposables = dispose(this._disposables);
}
}