mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
wip: extHostSCM, mainThreadSCM
This commit is contained in:
@@ -20,6 +20,7 @@ import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
|
||||
import { ExtHostTreeExplorers } from 'vs/workbench/api/node/extHostTreeExplorers';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { ExtHostQuickOpen } from 'vs/workbench/api/node/extHostQuickOpen';
|
||||
import { ExtHostSCM } from 'vs/workbench/api/node/extHostSCM';
|
||||
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
|
||||
import { ExtHostStatusBar } from 'vs/workbench/api/node/extHostStatusBar';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
|
||||
@@ -78,6 +79,7 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
|
||||
const extHostFileSystemEvent = col.define(ExtHostContext.ExtHostFileSystemEventService).set<ExtHostFileSystemEventService>(new ExtHostFileSystemEventService());
|
||||
const extHostQuickOpen = col.define(ExtHostContext.ExtHostQuickOpen).set<ExtHostQuickOpen>(new ExtHostQuickOpen(threadService));
|
||||
const extHostTerminalService = col.define(ExtHostContext.ExtHostTerminalService).set<ExtHostTerminalService>(new ExtHostTerminalService(threadService));
|
||||
const extHostSCM = col.define(ExtHostContext.ExtHostSCM).set<ExtHostSCM>(new ExtHostSCM(threadService));
|
||||
col.define(ExtHostContext.ExtHostExtensionService).set(extensionService);
|
||||
col.finish(false, threadService);
|
||||
|
||||
@@ -361,7 +363,7 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
|
||||
// namespace: scm
|
||||
const scm: typeof vscode.scm = {
|
||||
createSCMProvider: (id, delegate): vscode.SCMProvider => {
|
||||
throw new Error('JOAO not implemented');
|
||||
return extHostSCM.createSCMProvider(id, delegate);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import { MainThreadTerminalService } from './mainThreadTerminalService';
|
||||
import { MainThreadWorkspace } from './mainThreadWorkspace';
|
||||
import { MainProcessExtensionService } from './mainThreadExtensionService';
|
||||
import { MainThreadFileSystemEventService } from './mainThreadFileSystemEventService';
|
||||
import { MainThreadSCM } from './mainThreadSCM';
|
||||
|
||||
// --- other interested parties
|
||||
import { MainProcessTextMateSyntax } from 'vs/editor/node/textMate/TMSyntax';
|
||||
@@ -81,6 +82,7 @@ export class ExtHostContribution implements IWorkbenchContribution {
|
||||
col.define(MainContext.MainThreadTelemetry).set(create(MainThreadTelemetry));
|
||||
col.define(MainContext.MainThreadTerminalService).set(create(MainThreadTerminalService));
|
||||
col.define(MainContext.MainThreadWorkspace).set(create(MainThreadWorkspace));
|
||||
col.define(MainContext.MainThreadSCM).set(create(MainThreadSCM));
|
||||
if (this.extensionService instanceof MainProcessExtensionService) {
|
||||
col.define(MainContext.MainProcessExtensionService).set(<MainProcessExtensionService>this.extensionService);
|
||||
}
|
||||
|
||||
@@ -228,6 +228,9 @@ export abstract class MainProcessExtensionServiceShape {
|
||||
$onExtensionActivationFailed(extensionId: string): void { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadSCMShape {
|
||||
}
|
||||
|
||||
// -- extension host
|
||||
|
||||
export abstract class ExtHostCommandsShape {
|
||||
@@ -355,6 +358,9 @@ export abstract class ExtHostTerminalServiceShape {
|
||||
$acceptTerminalProcessId(id: number, processId: number): void { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostSCMShape {
|
||||
}
|
||||
|
||||
// --- proxy identifiers
|
||||
|
||||
export const MainContext = {
|
||||
@@ -376,6 +382,7 @@ export const MainContext = {
|
||||
MainThreadTerminalService: createMainId<MainThreadTerminalServiceShape>('MainThreadTerminalService', MainThreadTerminalServiceShape),
|
||||
MainThreadWorkspace: createMainId<MainThreadWorkspaceShape>('MainThreadWorkspace', MainThreadWorkspaceShape),
|
||||
MainProcessExtensionService: createMainId<MainProcessExtensionServiceShape>('MainProcessExtensionService', MainProcessExtensionServiceShape),
|
||||
MainThreadSCM: createMainId('MainThreadSCM', MainThreadSCMShape)
|
||||
};
|
||||
|
||||
export const ExtHostContext = {
|
||||
@@ -391,5 +398,6 @@ export const ExtHostContext = {
|
||||
ExtHostLanguageFeatures: createExtId<ExtHostLanguageFeaturesShape>('ExtHostLanguageFeatures', ExtHostLanguageFeaturesShape),
|
||||
ExtHostQuickOpen: createExtId<ExtHostQuickOpenShape>('ExtHostQuickOpen', ExtHostQuickOpenShape),
|
||||
ExtHostExtensionService: createExtId<ExtHostExtensionServiceShape>('ExtHostExtensionService', ExtHostExtensionServiceShape),
|
||||
ExtHostTerminalService: createExtId<ExtHostTerminalServiceShape>('ExtHostTerminalService', ExtHostTerminalServiceShape)
|
||||
ExtHostTerminalService: createExtId<ExtHostTerminalServiceShape>('ExtHostTerminalService', ExtHostTerminalServiceShape),
|
||||
ExtHostSCM: createExtId<ExtHostSCMShape>('ExtHostSCM', ExtHostSCMShape)
|
||||
};
|
||||
|
||||
46
src/vs/workbench/api/node/extHostSCM.ts
Normal file
46
src/vs/workbench/api/node/extHostSCM.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
|
||||
import { SCMProvider, SCMDelegate, SCMResourceGroup } from 'vscode';
|
||||
import { MainContext, MainThreadSCMShape } from './extHost.protocol';
|
||||
|
||||
export class ExtHostSCMProvider implements SCMProvider {
|
||||
|
||||
private static ID_GEN = 0;
|
||||
private _id: number = ExtHostSCMProvider.ID_GEN++;
|
||||
|
||||
constructor(
|
||||
private _proxy: MainThreadSCMShape,
|
||||
private _delegate: SCMDelegate
|
||||
) { }
|
||||
|
||||
get id(): number {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
createResourceGroup(id: string, label: string): SCMResourceGroup {
|
||||
// throw new Error('JOAO not implemented');
|
||||
return null;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
// todo
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtHostSCM {
|
||||
|
||||
private _proxy: MainThreadSCMShape;
|
||||
|
||||
constructor(threadService: IThreadService) {
|
||||
this._proxy = threadService.get(MainContext.MainThreadSCM);
|
||||
}
|
||||
|
||||
createSCMProvider(id: string, delegate: SCMDelegate): ExtHostSCMProvider {
|
||||
return new ExtHostSCMProvider(this._proxy, delegate);
|
||||
}
|
||||
}
|
||||
25
src/vs/workbench/api/node/mainThreadSCM.ts
Normal file
25
src/vs/workbench/api/node/mainThreadSCM.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
|
||||
import { MainThreadSCMShape } from './extHost.protocol';
|
||||
|
||||
export class MainThreadSCM extends MainThreadSCMShape {
|
||||
|
||||
private _toDispose: IDisposable;
|
||||
|
||||
constructor(
|
||||
@IThreadService threadService: IThreadService
|
||||
) {
|
||||
super();
|
||||
// const proxy = threadService.get(ExtHostContext.ExtHostSCM);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user