Skip to content

Commit ac34ea3

Browse files
authored
Clean up async code and walkthrough open command (microsoft#186263)
1 parent 35ddc72 commit ac34ea3

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ registerAction2(class extends Action2 {
6363
const selectedCategory = typeof walkthroughID === 'string' ? walkthroughID : walkthroughID.category;
6464
const selectedStep = typeof walkthroughID === 'string' ? undefined : walkthroughID.step;
6565

66-
let openedWalkthroughExists = false;
6766
// Try first to select the walkthrough on an active welcome page with no selected walkthrough
6867
for (const group of editorGroupsService.groups) {
6968
if (group.activeEditor instanceof GettingStartedInput) {
7069
if (!group.activeEditor.selectedCategory) {
7170
(group.activeEditorPane as GettingStartedPage).makeCategoryVisibleWhenAvailable(selectedCategory, selectedStep);
7271
return;
73-
} else {
74-
openedWalkthroughExists = true;
7572
}
7673
}
7774
}
@@ -86,8 +83,6 @@ registerAction2(class extends Action2 {
8683
editor.selectedStep = selectedStep;
8784
group.openEditor(editor, { revealIfOpened: true });
8885
return;
89-
} else {
90-
openedWalkthroughExists = true;
9186
}
9287
}
9388
}
@@ -106,7 +101,7 @@ registerAction2(class extends Action2 {
106101
editor: activeEditor,
107102
replacement: instantiationService.createInstance(GettingStartedInput, { selectedCategory: selectedCategory, selectedStep: selectedStep })
108103
}]);
109-
} else if (!openedWalkthroughExists) {
104+
} else {
110105
// else open respecting toSide
111106
editorService.openEditor({
112107
resource: GettingStartedInput.RESOURCE,

src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ export class GettingStartedPage extends EditorPane {
845845
this.editorInput.selectedCategory = undefined;
846846
this.editorInput.selectedStep = undefined;
847847
} else {
848-
await this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep);
848+
this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep);
849849
this.setSlide('details');
850850
return;
851851
}
@@ -867,7 +867,7 @@ export class GettingStartedPage extends EditorPane {
867867
if (first) {
868868
this.currentWalkthrough = first;
869869
this.editorInput.selectedCategory = this.currentWalkthrough?.id;
870-
await this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
870+
this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
871871
this.setSlide('details');
872872
return;
873873
}
@@ -1188,7 +1188,7 @@ export class GettingStartedPage extends EditorPane {
11881188
this.editorInput.selectedCategory = categoryID;
11891189
this.editorInput.selectedStep = stepId;
11901190
this.currentWalkthrough = ourCategory;
1191-
await this.buildCategorySlide(categoryID);
1191+
this.buildCategorySlide(categoryID);
11921192
this.setSlide('details');
11931193
});
11941194
}
@@ -1343,13 +1343,13 @@ export class GettingStartedPage extends EditorPane {
13431343
super.clearInput();
13441344
}
13451345

1346-
private async buildCategorySlide(categoryID: string, selectedStep?: string) {
1346+
private buildCategorySlide(categoryID: string, selectedStep?: string) {
13471347
if (this.detailsScrollbar) { this.detailsScrollbar.dispose(); }
13481348

1349-
await this.extensionService.whenInstalledExtensionsRegistered();
1350-
1351-
// Remove internal extension id specifier from exposed id's
1352-
await this.extensionService.activateByEvent(`onWalkthrough:${categoryID.replace(/[^#]+#/, '')}`);
1349+
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
1350+
// Remove internal extension id specifier from exposed id's
1351+
this.extensionService.activateByEvent(`onWalkthrough:${categoryID.replace(/[^#]+#/, '')}`);
1352+
});
13531353

13541354
this.detailsPageDisposables.clear();
13551355

0 commit comments

Comments
 (0)