Skip to content

Commit

Permalink
Added an option to be able to start a pet coding session automatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-Hopkinson committed Dec 15, 2023
1 parent 678afb4 commit 3fb6246
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@
"type": "boolean",
"default": false,
"description": "Throw ball with mouse"
},
"vscode-pets.autoStartPetCodingSession": {
"type": "boolean",
"default": false,
"description": "Automatically start a pet coding session when VS Code starts."
}
}
}
Expand Down
36 changes: 36 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,42 @@ export function activate(context: vscode.ExtensionContext) {
}),
);

// create a pet coding session on vscode start
let autoStart = vscode.workspace

Check failure on line 321 in src/extension/extension.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'autoStart' is never reassigned. Use 'const' instead
.getConfiguration('vscode-pets')
.get<Boolean>('autoStartPetCodingSession');
if (autoStart) {
if (
getConfigurationPosition() === ExtPosition.explorer &&
webviewViewProvider
) {
vscode.commands.executeCommand('petsView.focus');

Check warning on line 329 in src/extension/extension.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
} else {
const spec = PetSpecification.fromConfiguration();
PetPanel.createOrShow(
context.extensionUri,
spec.color,
spec.type,
spec.size,
getConfiguredTheme(),
getConfiguredThemeKind(),
getThrowWithMouseConfiguration(),
);

if (PetPanel.currentPanel) {
var collection = PetSpecification.collectionFromMemento(
context,
getConfiguredSize(),
);
collection.forEach((item) => {
PetPanel.currentPanel?.spawnPet(item);
});
// Store the collection in the memento, incase any of the null values (e.g. name) have been set
storeCollectionAsMemento(context, collection);

Check warning on line 351 in src/extension/extension.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
}
}
}

spawnPetStatusBar = vscode.window.createStatusBarItem(
vscode.StatusBarAlignment.Right,
100,
Expand Down

0 comments on commit 3fb6246

Please sign in to comment.