Skip to content

Commit

Permalink
add description propery to editor commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Aug 22, 2016
1 parent ad7c1fe commit 16dd81d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/vs/editor/common/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>;
Expand All @@ -67,6 +70,7 @@ export abstract class Command {
win: kbOpts.win,
linux: kbOpts.linux,
mac: kbOpts.mac,
description: this.description
};
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/vs/editor/common/editorCommonExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ export abstract class EditorAction extends ConfigEditorCommand {
}

public runEditorCommand(accessor:ServicesAccessor, editor: editorCommon.ICommonCodeEditor, args: any): void | TPromise<void> {
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<void>;
}

Expand Down

0 comments on commit 16dd81d

Please sign in to comment.