diff --git a/package.json b/package.json index f7a997832..b17dca014 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "onCommand:pacifica.runSimulator", "onCommand:pacifica.newFile", "onCommand:pacifica.runDevice", + "onCommand:pacifica.runSimulatorEditorButton", "onDebug" ], "main": "./out/extension.js", @@ -45,6 +46,11 @@ { "command": "pacifica.runSimulator", "title": "%pacificaExtension.commands.runSimulator%", + "category": "%pacificaExtension.commands.label%" + }, + { + "command": "pacifica.runSimulatorEditorButton", + "title": "%pacificaExtension.commands.runSimulator%", "category": "%pacificaExtension.commands.label%", "icon": { "light": "./assets/light-theme/run-on-simulator.svg", @@ -67,6 +73,12 @@ } ], "menus": { + "commandPalette": [ + { + "command": "pacifica.runSimulatorEditorButton", + "when": "false" + } + ], "editor/title": [ { "when": "editorLangId==python && config.pacifica.showOpenIconInEditorTitleMenu", @@ -75,7 +87,7 @@ }, { "when": "editorLangId==python && config.pacifica.showSimulatorIconInEditorTitleMenu", - "command": "pacifica.runSimulator", + "command": "pacifica.runSimulatorEditorButton", "group": "navigation@2" }, { @@ -257,4 +269,4 @@ "extensionDependencies": [ "ms-python.python" ] -} +} \ No newline at end of file diff --git a/src/constants.ts b/src/constants.ts index 7fd869014..1229930fa 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -128,7 +128,9 @@ export enum TelemetryEventName { COMMAND_DEPLOY_DEVICE = "COMMAND.DEPLOY.DEVICE", COMMAND_NEW_FILE = "COMMAND.NEW.FILE", COMMAND_OPEN_SIMULATOR = "COMMAND.OPEN.SIMULATOR", - COMMAND_RUN_SIMULATOR = "COMMAND.RUN.SIMULATOR", + COMMAND_RUN_SIMULATOR_BUTTON = "COMMAND.RUN.SIMULATOR_BUTTON", + COMMAND_RUN_PALETTE = "COMMAND.RUN.PALETTE", + COMMAND_RUN_EDITOR_ICON = "COMMAND.RUN.EDITOR_ICON", // Simulator interaction SIMULATOR_BUTTON_A = "SIMULATOR.BUTTON.A", diff --git a/src/extension.ts b/src/extension.ts index f8bd6f680..2705f19c5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -101,6 +101,7 @@ export async function activate(context: vscode.ExtensionContext) { console.log("Play button"); console.log(messageJson + "\n"); if (message.text as boolean) { + telemetryAI.trackFeatureUsage(TelemetryEventName.COMMAND_RUN_SIMULATOR_BUTTON); runSimulatorCommand(); } else { killProcessIfRunning(); @@ -263,7 +264,6 @@ export async function activate(context: vscode.ExtensionContext) { } console.info(CONSTANTS.INFO.RUNNING_CODE); - telemetryAI.trackFeatureUsage(TelemetryEventName.COMMAND_RUN_SIMULATOR); logToOutputChannel(outChannel, CONSTANTS.INFO.DEPLOY_SIMULATOR); @@ -335,7 +335,7 @@ export async function activate(context: vscode.ExtensionContext) { case "print": console.log( `Process print statement output = ${ - messageToWebview.data + messageToWebview.data }` ); logToOutputChannel( @@ -376,10 +376,17 @@ export async function activate(context: vscode.ExtensionContext) { } }; + const runSimulatorEditorButton: vscode.Disposable = vscode.commands.registerCommand("pacifica.runSimulatorEditorButton", + () => { + telemetryAI.trackFeatureUsage(TelemetryEventName.COMMAND_RUN_EDITOR_ICON); + runSimulatorCommand(); + }); + // Send message to the webview const runSimulator: vscode.Disposable = vscode.commands.registerCommand( "pacifica.runSimulator", () => { + telemetryAI.trackFeatureUsage(TelemetryEventName.COMMAND_RUN_PALETTE); runSimulatorCommand(); } ); @@ -506,6 +513,7 @@ export async function activate(context: vscode.ExtensionContext) { context.subscriptions.push( openSimulator, runSimulator, + runSimulatorEditorButton, runDevice, newFile, vscode.debug.registerDebugConfigurationProvider( @@ -615,4 +623,4 @@ function getWebviewContent(context: vscode.ExtensionContext) { } // this method is called when your extension is deactivated -export function deactivate() {} +export function deactivate() { }