mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
git status through extension!
This commit is contained in:
@@ -6,12 +6,11 @@
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import Event, { Emitter/*, debounceEvent*/ } from 'vs/base/common/event';
|
||||
// import { index } from 'vs/base/common/arrays';
|
||||
import Event, { Emitter, debounceEvent } from 'vs/base/common/event';
|
||||
import { asWinJsPromise } from 'vs/base/common/async';
|
||||
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
|
||||
import { Disposable } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { MainContext, MainThreadSCMShape/*, SCMRawResource*/ } from './extHost.protocol';
|
||||
import { MainContext, MainThreadSCMShape, SCMRawResource, SCMRawResourceGroup } from './extHost.protocol';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class ExtHostSCM {
|
||||
@@ -37,37 +36,26 @@ export class ExtHostSCM {
|
||||
// TODO@joao: should pluck all the things out of the provider
|
||||
this._providers[id] = provider;
|
||||
|
||||
// const resourceGroupsIds = provider.resourceGroups.map(g => g.id);
|
||||
this._proxy.$register(id, {
|
||||
label: provider.label,
|
||||
commitCommand: provider.commitCommand,
|
||||
clickCommand: provider.clickCommand,
|
||||
dragCommand: provider.dragCommand,
|
||||
supportsOriginalResource: !!provider.getOriginalResource
|
||||
});
|
||||
|
||||
// this._proxy.$register(id, {
|
||||
// commitCommand: provider.commitCommand,
|
||||
// clickCommand: provider.clickCommand,
|
||||
// dragCommand: provider.dragCommand,
|
||||
// resourceGroups: provider.resourceGroups,
|
||||
// supportsOriginalResource: !!provider.getOriginalResource
|
||||
// });
|
||||
const onDidChange = debounceEvent(provider.onDidChange, (l, e) => e, 200);
|
||||
const onDidChangeListener = onDidChange(resourceGroups => {
|
||||
const rawResourceGroups = resourceGroups.map(g => {
|
||||
const rawResources = g.resources.map(r => [r.uri.toString()] as SCMRawResource);
|
||||
return [g.id, g.label, rawResources] as SCMRawResourceGroup;
|
||||
});
|
||||
|
||||
// const onDidChange = debounceEvent<vscode.SCMResource[], vscode.SCMResource[]>(provider.onDidChange, (l, e) => e, 200);
|
||||
// const onDidChangeListener = onDidChange(resources => {
|
||||
// const resourceGroupsById = index(resourceGroupsIds, id => id, () => [] as SCMRawResource[]);
|
||||
|
||||
// resources.forEach(resource => {
|
||||
// const resourceGroup = resourceGroupsById[resource.resourceGroup];
|
||||
|
||||
// if (!resourceGroup) {
|
||||
// // TODO@Joao: ask Joh: should we warn? should we throw?
|
||||
// return;
|
||||
// }
|
||||
|
||||
// resourceGroup.push({ uri: resource.uri.toString() });
|
||||
// });
|
||||
|
||||
// const result = resourceGroupsIds.map(id => resourceGroupsById[id]);
|
||||
// this._proxy.$onChange(id, result);
|
||||
// });
|
||||
this._proxy.$onChange(id, rawResourceGroups);
|
||||
});
|
||||
|
||||
return new Disposable(() => {
|
||||
// onDidChangeListener.dispose();
|
||||
onDidChangeListener.dispose();
|
||||
delete this._providers[id];
|
||||
this._proxy.$unregister(id);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user