Skip to content

Commit 1eedb37

Browse files
Fix the registerIDFCommand by returning the closure's result (VSC-382) (#143)
* expected result from callback registerIdfCommand * at any as return type for telemetry cb
1 parent 620b449 commit 1eedb37

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/extension.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ export async function activate(context: vscode.ExtensionContext) {
139139
name: string,
140140
callback: (...args: any[]) => any
141141
): number => {
142-
const telemetryCallback = (...args: any[]) => {
142+
const telemetryCallback = (...args: any[]): any => {
143143
const startTime = Date.now();
144144
Logger.info(`Command::${name}::Executed`);
145-
callback.apply(this, args);
145+
const cbResult = callback.apply(this, args);
146146
const timeSpent = Date.now() - startTime;
147147
Telemetry.sendEvent("command", { commandName: name }, { timeSpent });
148+
return cbResult;
148149
};
149150
return context.subscriptions.push(
150151
vscode.commands.registerCommand(name, telemetryCallback)

0 commit comments

Comments
 (0)