mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Close #122795
This commit is contained in:
parent
cd8bf7ba53
commit
28767c88f0
|
@ -25,6 +25,7 @@ import product from 'vs/platform/product/common/product';
|
|||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { EditorOverride } from 'vs/platform/editor/common/editor';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
|
||||
|
||||
export * as icons from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedIcons';
|
||||
|
@ -122,6 +123,19 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'walkthroughs.selectStep',
|
||||
handler: (accessor, stepID: string) => {
|
||||
const editorService = accessor.get(IEditorService);
|
||||
const editorPane = editorService.activeEditorPane;
|
||||
if (editorPane instanceof GettingStartedPage) {
|
||||
editorPane.selectStepLoose(stepID);
|
||||
} else {
|
||||
console.error('Cannot run walkthroughs.selectStep outside of walkthrough context');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
|
|
|
@ -234,7 +234,8 @@ export class GettingStartedPage extends EditorPane {
|
|||
}
|
||||
|
||||
async makeCategoryVisibleWhenAvailable(categoryID: string) {
|
||||
await this.extensionService.whenInstalledExtensionsRegistered();
|
||||
await this.gettingStartedService.installedExtensionsRegistered;
|
||||
|
||||
this.gettingStartedCategories = this.gettingStartedService.getCategories();
|
||||
const ourCategory = this.gettingStartedCategories.find(c => c.id === categoryID);
|
||||
if (!ourCategory) {
|
||||
|
@ -444,6 +445,11 @@ export class GettingStartedPage extends EditorPane {
|
|||
}
|
||||
}
|
||||
|
||||
async selectStepLoose(id: string) {
|
||||
const toSelect = this.editorInput.selectedCategory + '#' + id;
|
||||
this.selectStep(toSelect);
|
||||
}
|
||||
|
||||
private async selectStep(id: string | undefined, delayFocus = true, forceRebuild = false) {
|
||||
if (id && this.editorInput.selectedStep === id && !forceRebuild) { return; }
|
||||
|
||||
|
|
|
@ -128,6 +128,8 @@ export interface IGettingStartedService {
|
|||
progressByEvent(eventName: string): void;
|
||||
progressStep(id: string): void;
|
||||
deprogressStep(id: string): void;
|
||||
|
||||
installedExtensionsRegistered: Promise<void>;
|
||||
}
|
||||
|
||||
export class GettingStartedService extends Disposable implements IGettingStartedService {
|
||||
|
@ -162,6 +164,9 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
|
||||
private trackedContextKeys = new Set<string>();
|
||||
|
||||
private triggerInstalledExtensionsRegistered!: () => void;
|
||||
installedExtensionsRegistered: Promise<void>;
|
||||
|
||||
constructor(
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@ICommandService private readonly commandService: ICommandService,
|
||||
|
@ -207,6 +212,8 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
if (userDataAutoSyncEnablementService.isEnabled()) { this.progressByEvent('onEvent:sync-enabled'); }
|
||||
}));
|
||||
|
||||
this.installedExtensionsRegistered = new Promise(r => this.triggerInstalledExtensionsRegistered = r);
|
||||
|
||||
startEntries.forEach(async (entry, index) => {
|
||||
this.getCategoryOverrides(entry);
|
||||
this.registerStartEntry({
|
||||
|
@ -418,6 +425,8 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
this.registerWalkthrough(walkthoughDescriptior, steps);
|
||||
}));
|
||||
|
||||
this.triggerInstalledExtensionsRegistered();
|
||||
|
||||
if (sectionToOpen && this.configurationService.getValue<string>('workbench.welcomePage.experimental.extensionContributions') !== 'hide') {
|
||||
this.commandService.executeCommand('workbench.action.openWalkthrough', sectionToOpen);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue