From 7b9ed665a655bd487f729a3fa489ffe8639355a8 Mon Sep 17 00:00:00 2001 From: Harry Hopkinson Date: Mon, 27 Feb 2023 17:27:13 +0000 Subject: [PATCH] Toggle Slider for Throwing the Ball with the Mouse. --- package.json | 12 +----------- src/extension/extension.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index f6fa0066..954a617e 100644 --- a/package.json +++ b/package.json @@ -30,18 +30,8 @@ "license": "MIT", "icon": "icon.png", "activationEvents": [ - "onCommand:vscode-pets.start", - "onCommand:vscode-pets.throw-with-mouse", - "onCommand:vscode-pets.throw-ball", - "onCommand:vscode-pets.spawn-pet", - "onCommand:vscode-pets.delete-pet", - "onCommand:vscode-pets.remove-all-pets", - "onCommand:vscode-pets.roll-call", - "onCommand:vscode-pets.export-pet-list", - "onCommand:vscode-pets.import-pet-list", "onWebviewPanel:petCoding", "onView:explorer", - "onView:petsView", "onStartupFinished" ], "main": "./out/extension/extension.js", @@ -85,7 +75,7 @@ "icon": "media/dog.svg" }, { - "command": "vscode-pets.throw-with-mouse", + "command": "vscode-pets.throwBallWithMouse", "title": "Throw ball with mouse", "category": "Pet Coding", "icon": { diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 63196d9d..5e993a93 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -367,6 +367,27 @@ export function activate(context: vscode.ExtensionContext) { }), ); + context.subscriptions.push( + vscode.commands.registerCommand( + 'vscode-pets.throwBallWithMouse', + () => { + const config = vscode.workspace.getConfiguration('vscode-pets'); + config.update( + 'throwBallWithMouse', + !getThrowWithMouseConfiguration(), + vscode.ConfigurationTarget.Global, + ); + + vscode.window.showInformationMessage( + vscode.l10n.t( + 'Throw ball with mouse is now {0}.', + getThrowWithMouseConfiguration() ? 'off' : 'on', + ), + ); + }, + ), + ); + context.subscriptions.push( vscode.commands.registerCommand('vscode-pets.delete-pet', async () => { const panel = getPetPanel();