Skip to content

Commit

Permalink
- fix: solved 'Throw ball with mouse' option not working in command p…
Browse files Browse the repository at this point in the history
…alatte #375

- removed activationEvents as VS Code will generate these automatically
  • Loading branch information
PraneshBalasubramaniam committed Sep 9, 2023
1 parent 303af6e commit ab5a814
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,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",
Expand Down
18 changes: 16 additions & 2 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ function getThrowWithMouseConfiguration(): boolean {
.get<boolean>('throwBallWithMouse', true);
}

function updateThrowWithMouseConfiguration() {
const config = vscode.workspace
.getConfiguration('vscode-pets');
const newValue = !config.get<boolean>('throwBallWithMouse', true);
config
.update('throwBallWithMouse', newValue, vscode.ConfigurationTarget.Global);
}

function updatePanelThrowWithMouse(): void {
const panel = getPetPanel();
if (panel !== undefined) {
Expand Down Expand Up @@ -365,6 +373,12 @@ export function activate(context: vscode.ExtensionContext) {
}),
);

context.subscriptions.push(
vscode.commands.registerCommand('vscode-pets.throw-with-mouse',
updateThrowWithMouseConfiguration
),
);

context.subscriptions.push(
vscode.commands.registerCommand('vscode-pets.delete-pet', async () => {
const panel = getPetPanel();
Expand Down Expand Up @@ -855,9 +869,9 @@ class PetWebviewContainer implements IPetPanel {
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${
webview.cspSource
} 'nonce-${nonce}'; img-src ${
} 'nonce-${nonce}'; img-src ${
webview.cspSource
} https:; script-src 'nonce-${nonce}';
} https:; script-src 'nonce-${nonce}';
font-src ${webview.cspSource};">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${stylesResetUri}" rel="stylesheet" nonce="${nonce}">
Expand Down

0 comments on commit ab5a814

Please sign in to comment.