Skip to content

Commit 7a9f8ad

Browse files
filiptronicekjeanp413
authored andcommitted
Only automatically open the Walkthroughs once
1 parent d96701e commit 7a9f8ad

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

extensions/gitpod-web/src/extension.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ export async function activate(context: vscode.ExtensionContext) {
4343
vscode.window.createTerminal();
4444
}
4545
});
46+
47+
const versionKey = 'walkthrough.version';
48+
context.globalState.setKeysForSync([versionKey]);
49+
4650
registerWelcomeWalkthroughCommands(gitpodContext);
47-
startWelcomeWalkthrough();
51+
startWelcomeWalkthrough(context, versionKey);
4852

4953
const codeServer = new GitpodCodeServer();
5054
registerCLI(codeServer, gitpodContext);
@@ -769,10 +773,17 @@ export function registerWelcomeWalkthroughCommands(context: GitpodExtensionConte
769773
}));
770774
}
771775

772-
export function startWelcomeWalkthrough() {
773-
if (vscode.window.visibleTextEditors.length === 0) {
774-
vscode.commands.executeCommand('workbench.action.openWalkthrough', 'gitpod.gitpod-web#gitpod-getstarted', false);
776+
export function startWelcomeWalkthrough(context: vscode.ExtensionContext, versionKey: string): void {
777+
type WalkthroughVersion = 0.1;
778+
const currentVersion: WalkthroughVersion = 0.1;
779+
const lastVersionShown = context.globalState.get<number>(versionKey);
780+
781+
if (typeof lastVersionShown === 'number' || vscode.window.visibleTextEditors.length !== 0) {
782+
return;
775783
}
784+
785+
context.globalState.update(versionKey, currentVersion);
786+
vscode.commands.executeCommand('workbench.action.openWalkthrough', 'gitpod.gitpod-web#gitpod-getstarted', false);
776787
}
777788

778789
export function registerCLI(codeServer: GitpodCodeServer, context: GitpodExtensionContext): void {

0 commit comments

Comments
 (0)