Skip to content

Commit 048581b

Browse files
committed
💄 registerApiCommand
1 parent 0086546 commit 048581b

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {ExtHostMessageService} from 'vs/workbench/api/common/extHostMessageServi
2121
import {ExtHostEditors} from 'vs/workbench/api/common/extHostEditors';
2222
import {ExtHostLanguages} from 'vs/workbench/api/common/extHostLanguages';
2323
import {ExtHostLanguageFeatures} from 'vs/workbench/api/common/extHostLanguageFeatures';
24-
import {ExtHostApiCommands} from 'vs/workbench/api/common/extHostApiCommands';
24+
import {registerApiCommands} from 'vs/workbench/api/common/extHostApiCommands';
2525
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
2626
import 'vs/workbench/api/common/extHostTypes.marshalling';
2727
import Modes = require('vs/editor/common/modes');
@@ -257,11 +257,13 @@ export class ExtHostAPIImplementation {
257257
}
258258
});
259259

260+
//
261+
registerApiCommands(threadService);
262+
260263
//
261264
const languages = new ExtHostLanguages(this._threadService);
262265
const pluginHostDiagnostics = new ExtHostDiagnostics(this._threadService);
263266
const languageFeatures = threadService.getRemotable(ExtHostLanguageFeatures);
264-
const languageFeatureCommand = new ExtHostApiCommands(threadService.getRemotable(ExtHostCommands));
265267

266268
this.languages = {
267269
createDiagnosticCollection(name?: string): vscode.DiagnosticCollection {

src/vs/workbench/api/common/extHostApiCommands.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ import {IQuickFix2} from 'vs/editor/contrib/quickFix/common/quickFix';
1818
import {IOutline} from 'vs/editor/contrib/quickOpen/common/quickOpen';
1919
import {ITypeBearing} from 'vs/workbench/parts/search/common/search';
2020
import {ICodeLensData} from 'vs/editor/contrib/codelens/common/codelens';
21+
import {IThreadService} from 'vs/platform/thread/common/thread';
2122

22-
export class ExtHostApiCommands {
23+
export function registerApiCommands(threadService: IThreadService) {
24+
const commands = threadService.getRemotable(ExtHostCommands);
25+
new ExtHostApiCommands(commands);
26+
}
27+
28+
class ExtHostApiCommands {
2329

2430
private _commands: ExtHostCommands;
2531
private _disposables: IDisposable[] = [];

src/vs/workbench/test/common/api/extHostApiCommands.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingServic
2323
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
2424
import {IModelService} from 'vs/editor/common/services/modelService';
2525
import {ExtHostLanguageFeatures, MainThreadLanguageFeatures} from 'vs/workbench/api/common/extHostLanguageFeatures';
26-
import {ExtHostApiCommands} from 'vs/workbench/api/common/extHostApiCommands';
26+
import {registerApiCommands} from 'vs/workbench/api/common/extHostApiCommands';
2727
import {ExtHostCommands, MainThreadCommands} from 'vs/workbench/api/common/extHostCommands';
2828
import {ExtHostModelService} from 'vs/workbench/api/common/extHostDocuments';
2929

30-
const defaultSelector = { scheme: 'far' };
3130
const model: EditorCommon.IModel = new EditorModel(
3231
[
3332
'This is the first line',
@@ -86,7 +85,7 @@ suite('ExtHostLanguageFeatureCommands', function() {
8685

8786
threadService.getRemotable(MainThreadCommands);
8887
commands = threadService.getRemotable(ExtHostCommands);
89-
new ExtHostApiCommands(commands);
88+
registerApiCommands(threadService);
9089
mainThread = threadService.getRemotable(MainThreadLanguageFeatures);
9190
extHost = threadService.getRemotable(ExtHostLanguageFeatures);
9291
});

0 commit comments

Comments
 (0)