log ext host commands, ext hsot scm

This commit is contained in:
Joao Moreno
2017-11-29 14:22:38 +01:00
parent 2b5d14e446
commit 4e78a42abf
14 changed files with 66 additions and 31 deletions

View File

@@ -15,6 +15,7 @@ import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
import * as modes from 'vs/editor/common/modes';
import * as vscode from 'vscode';
import { ILogService, log, LogLevel } from 'vs/platform/log/common/log';
interface CommandHandler {
callback: Function;
@@ -35,7 +36,9 @@ export class ExtHostCommands implements ExtHostCommandsShape {
constructor(
mainContext: IMainContext,
heapService: ExtHostHeapService
heapService: ExtHostHeapService,
// @ts-ignore
@ILogService private logService: ILogService
) {
this._proxy = mainContext.get(MainContext.MainThreadCommands);
this._converter = new CommandsConverter(this, heapService);
@@ -49,6 +52,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
this._argumentProcessors.push(processor);
}
@log(LogLevel.TRACE, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
registerCommand(id: string, callback: <T>(...args: any[]) => T | Thenable<T>, thisArg?: any, description?: ICommandHandlerDescription): extHostTypes.Disposable {
if (!id.trim().length) {
@@ -69,6 +73,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
});
}
@log(LogLevel.TRACE, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
executeCommand<T>(id: string, ...args: any[]): Thenable<T> {
if (this._commands.has(id)) {
@@ -133,6 +138,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
}
}
@log(LogLevel.TRACE, 'ExtHostCommands', (msg, filterUnderscoreCommands) => `${msg}(${filterUnderscoreCommands})`)
getCommands(filterUnderscoreCommands: boolean = false): Thenable<string[]> {
return this._proxy.$getCommands().then(result => {
if (filterUnderscoreCommands) {