diff --git a/package.json b/package.json index 04050e4f..4957c35a 100644 --- a/package.json +++ b/package.json @@ -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." } } } diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 63196d9d..df306a78 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -317,6 +317,42 @@ export function activate(context: vscode.ExtensionContext) { }), ); + // create a pet coding session on vscode start + let autoStart = vscode.workspace + .getConfiguration('vscode-pets') + .get('autoStartPetCodingSession'); + if (autoStart) { + if ( + getConfigurationPosition() === ExtPosition.explorer && + webviewViewProvider + ) { + vscode.commands.executeCommand('petsView.focus'); + } 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); + } + } + } + spawnPetStatusBar = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Right, 100,