Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option to be able to start a pet coding session automatically. #518

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
37 changes: 37 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,43 @@ export function activate(context: vscode.ExtensionContext) {
}),
);

// create a pet coding session on vscode start
const autoStart = vscode.workspace
.getConfiguration('vscode-pets')
.get<Boolean>('autoStartPetCodingSession');
if (autoStart) {
if (
Harry-Hopkinson marked this conversation as resolved.
Show resolved Hide resolved
getConfigurationPosition() === ExtPosition.explorer &&
webviewViewProvider
) {
// eslint-disable-next-line
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);
});
// eslint-disable-next-line
storeCollectionAsMemento(context, collection);
}
}
}

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