Merge branch 'scm-viewlet'

This commit is contained in:
Joao Moreno
2017-09-19 17:34:58 +02:00
27 changed files with 1944 additions and 151 deletions

View File

@@ -100,18 +100,17 @@ class MainThreadSCMProvider implements ISCMProvider {
get handle(): number { return this._handle; }
get label(): string { return this._label; }
get rootUri(): URI | undefined { return this._rootUri; }
get contextValue(): string { return this._contextValue; }
get commitTemplate(): string | undefined { return this.features.commitTemplate; }
get acceptInputCommand(): Command | undefined { return this.features.acceptInputCommand; }
get statusBarCommands(): Command[] | undefined { return this.features.statusBarCommands; }
get count(): number | undefined { return this.features.count; }
private _onDidChangeCommitTemplate = new Emitter<string>();
get onDidChangeCommitTemplate(): Event<string> { return this._onDidChangeCommitTemplate.event; }
private _count: number | undefined = undefined;
get count(): number | undefined { return this._count; }
private _onDidChange = new Emitter<void>();
get onDidChange(): Event<void> { return this._onDidChange.event; }
@@ -120,15 +119,12 @@ class MainThreadSCMProvider implements ISCMProvider {
private _handle: number,
private _contextValue: string,
private _label: string,
private _rootUri: URI | undefined,
@ISCMService scmService: ISCMService,
@ICommandService private commandService: ICommandService
) { }
$updateSourceControl(features: SCMProviderFeatures): void {
if ('count' in features) {
this._count = features.count;
}
this.features = assign(this.features, features);
this._onDidChange.fire();
@@ -275,8 +271,8 @@ export class MainThreadSCM implements MainThreadSCMShape {
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);
$registerSourceControl(handle: number, id: string, label: string, rootUri: string | undefined): void {
const provider = new MainThreadSCMProvider(this._proxy, handle, id, label, rootUri && URI.parse(rootUri), this.scmService, this.commandService);
const repository = this.scmService.registerSCMProvider(provider);
this._repositories[handle] = repository;

View File

@@ -486,14 +486,14 @@ export function createApiFactory(
get inputBox() {
return extHostSCM.getLastInputBox(extension);
},
createSourceControl(id: string, label: string) {
createSourceControl(id: string, label: string, rootUri?: vscode.Uri) {
mainThreadTelemetry.$publicLog('registerSCMProvider', {
extensionId: extension.id,
providerId: id,
providerLabel: label
});
return extHostSCM.createSourceControl(extension, id, label);
return extHostSCM.createSourceControl(extension, id, label, rootUri);
}
};

View File

@@ -363,7 +363,7 @@ export type SCMRawResourceSplices = [
];
export interface MainThreadSCMShape extends IDisposable {
$registerSourceControl(handle: number, id: string, label: string): void;
$registerSourceControl(handle: number, id: string, label: string, rootUri: string | undefined): void;
$updateSourceControl(handle: number, features: SCMProviderFeatures): void;
$unregisterSourceControl(handle: number): void;

View File

@@ -287,6 +287,10 @@ class ExtHostSourceControl implements vscode.SourceControl {
return this._label;
}
get rootUri(): vscode.Uri | undefined {
return this._rootUri;
}
private _inputBox: ExtHostSCMInputBox;
get inputBox(): ExtHostSCMInputBox { return this._inputBox; }
@@ -356,9 +360,10 @@ class ExtHostSourceControl implements vscode.SourceControl {
private _commands: ExtHostCommands,
private _id: string,
private _label: string,
private _rootUri?: vscode.Uri
) {
this._inputBox = new ExtHostSCMInputBox(this._proxy, this.handle);
this._proxy.$registerSourceControl(this.handle, _id, _label);
this._proxy.$registerSourceControl(this.handle, _id, _label, _rootUri && _rootUri.toString());
}
private updatedResourceGroups = new Set<ExtHostSourceControlResourceGroup>();
@@ -468,9 +473,9 @@ export class ExtHostSCM {
});
}
createSourceControl(extension: IExtensionDescription, id: string, label: string): vscode.SourceControl {
createSourceControl(extension: IExtensionDescription, id: string, label: string, rootUri: vscode.Uri | undefined): vscode.SourceControl {
const handle = ExtHostSCM._handlePool++;
const sourceControl = new ExtHostSourceControl(this._proxy, this._commands, id, label);
const sourceControl = new ExtHostSourceControl(this._proxy, this._commands, id, label, rootUri);
this._sourceControls.set(handle, sourceControl);
const sourceControls = this._sourceControlsByExtension.get(extension.id) || [];