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

Clean up async code and walkthrough open command #186263

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ registerAction2(class extends Action2 {
const selectedCategory = typeof walkthroughID === 'string' ? walkthroughID : walkthroughID.category;
const selectedStep = typeof walkthroughID === 'string' ? undefined : walkthroughID.step;

let openedWalkthroughExists = false;
// Try first to select the walkthrough on an active welcome page with no selected walkthrough
for (const group of editorGroupsService.groups) {
if (group.activeEditor instanceof GettingStartedInput) {
if (!group.activeEditor.selectedCategory) {
(group.activeEditorPane as GettingStartedPage).makeCategoryVisibleWhenAvailable(selectedCategory, selectedStep);
return;
} else {
openedWalkthroughExists = true;
}
}
}
Expand All @@ -86,8 +83,6 @@ registerAction2(class extends Action2 {
editor.selectedStep = selectedStep;
group.openEditor(editor, { revealIfOpened: true });
return;
} else {
openedWalkthroughExists = true;
}
}
}
Expand All @@ -106,7 +101,7 @@ registerAction2(class extends Action2 {
editor: activeEditor,
replacement: instantiationService.createInstance(GettingStartedInput, { selectedCategory: selectedCategory, selectedStep: selectedStep })
}]);
} else if (!openedWalkthroughExists) {
} else {
// else open respecting toSide
editorService.openEditor({
resource: GettingStartedInput.RESOURCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ export class GettingStartedPage extends EditorPane {
this.editorInput.selectedCategory = undefined;
this.editorInput.selectedStep = undefined;
} else {
await this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep);
this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep);
this.setSlide('details');
return;
}
Expand All @@ -867,7 +867,7 @@ export class GettingStartedPage extends EditorPane {
if (first) {
this.currentWalkthrough = first;
this.editorInput.selectedCategory = this.currentWalkthrough?.id;
await this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
this.buildCategorySlide(this.editorInput.selectedCategory, undefined);
this.setSlide('details');
return;
}
Expand Down Expand Up @@ -1188,7 +1188,7 @@ export class GettingStartedPage extends EditorPane {
this.editorInput.selectedCategory = categoryID;
this.editorInput.selectedStep = stepId;
this.currentWalkthrough = ourCategory;
await this.buildCategorySlide(categoryID);
this.buildCategorySlide(categoryID);
this.setSlide('details');
});
}
Expand Down Expand Up @@ -1343,13 +1343,13 @@ export class GettingStartedPage extends EditorPane {
super.clearInput();
}

private async buildCategorySlide(categoryID: string, selectedStep?: string) {
private buildCategorySlide(categoryID: string, selectedStep?: string) {
if (this.detailsScrollbar) { this.detailsScrollbar.dispose(); }

await this.extensionService.whenInstalledExtensionsRegistered();

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

this.detailsPageDisposables.clear();

Expand Down