From 16dd81dae202ca8685ae2fa7a32ea7aab030f1e0 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 22 Aug 2016 15:36:05 +0200 Subject: [PATCH] add description propery to editor commands --- src/vs/editor/common/config/config.ts | 4 ++++ src/vs/editor/common/editorCommonExtensions.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/common/config/config.ts b/src/vs/editor/common/config/config.ts index d7069c079ac02..e06267c18df08 100644 --- a/src/vs/editor/common/config/config.ts +++ b/src/vs/editor/common/config/config.ts @@ -30,17 +30,20 @@ export interface ICommandOptions { id: string; precondition: ContextKeyExpr; kbOpts?: ICommandKeybindingsOptions; + description?: ICommandHandlerDescription; } export abstract class Command { public id: string; public precondition: ContextKeyExpr; private kbOpts: ICommandKeybindingsOptions; + private description: ICommandHandlerDescription; constructor(opts:ICommandOptions) { this.id = opts.id; this.precondition = opts.precondition; this.kbOpts = opts.kbOpts; + this.description = opts.description; } public abstract runCommand(accessor:ServicesAccessor, args: any): void | TPromise; @@ -67,6 +70,7 @@ export abstract class Command { win: kbOpts.win, linux: kbOpts.linux, mac: kbOpts.mac, + description: this.description }; } } diff --git a/src/vs/editor/common/editorCommonExtensions.ts b/src/vs/editor/common/editorCommonExtensions.ts index 7a0831137c541..e73a75aacf44b 100644 --- a/src/vs/editor/common/editorCommonExtensions.ts +++ b/src/vs/editor/common/editorCommonExtensions.ts @@ -62,10 +62,14 @@ export abstract class EditorAction extends ConfigEditorCommand { } public runEditorCommand(accessor:ServicesAccessor, editor: editorCommon.ICommonCodeEditor, args: any): void | TPromise { - accessor.get(ITelemetryService).publicLog('editorActionInvoked', { name: this.label, id: this.id }); + this.reportTelemetry(accessor); return this.run(accessor, editor); } + protected reportTelemetry(accessor:ServicesAccessor){ + accessor.get(ITelemetryService).publicLog('editorActionInvoked', { name: this.label, id: this.id }); + } + public abstract run(accessor:ServicesAccessor, editor:editorCommon.ICommonCodeEditor): void | TPromise; }