Change:
Ref contributes a lot of actions. Some actions can likely be contributed after others. This issue tracks splitting up that contribution into a few smaller ones, so that some of the contributions can be set to run at a later phase.

Discussion:
} }); <del> const registerOpenUserSettingsEditorFromJsonActionDisposables = this._register(new MutableDisposable()); const openUserSettingsEditorWhen = ContextKeyExpr.and( ContextKeyExpr.or(ResourceContextKey.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()), ResourceContextKey.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())), ContextKeyExpr.not('isInDiffEditor')); const registerOpenUserSettingsEditorFromJsonAction = () => { registerOpenUserSettingsEditorFromJsonActionDisposables.value = registerAction2(class extends Action2 { constructor() { super({ id: '_workbench.openUserSettingsEditor', title: OPEN_USER_SETTINGS_UI_TITLE, icon: preferencesOpenSettingsIcon, menu: [{ id: MenuId.EditorTitle, when: openUserSettingsEditorWhen, group: 'navigation', order: 1 }] }); } run(accessor: ServicesAccessor, args: IOpenSettingsActionOptions) { args = sanitizeOpenSettingsArgs(args); return accessor.get(IPreferencesService).openUserSettings({ jsonEditor: false, ...args }); } }); }; const openSettingsJsonWhen = ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_JSON_EDITOR.toNegated()); registerAction2(class extends Action2 { constructor() { super({ id: SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON, title: { value: nls.localize('openSettingsJson', "Open Settings (JSON)"), original: 'Open Settings (JSON)' }, icon: preferencesOpenSettingsIcon, menu: [{ id: MenuId.EditorTitle, when: openSettingsJsonWhen, group: 'navigation', order: 1 }] }); } run(accessor: ServicesAccessor) { const editorPane = accessor.get(IEditorService).activeEditorPane; if (editorPane instanceof SettingsEditor2) { return editorPane.switchToSettingsFile(); } return null; } }); registerOpenUserSettingsEditorFromJsonAction(); this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => { // Force the action to check the context again. registerOpenUserSettingsEditorFromJsonAction(); })); </del> registerAction2(class extends Action2 { constructor() { super({

} } <ins> class SettingsEditorTitleContribution extends Disposable implements IWorkbenchContribution { constructor( @IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService, @IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService, ) { super(); this.registerSettingsEditorTitleActions(); } private registerSettingsEditorTitleActions() { const registerOpenUserSettingsEditorFromJsonActionDisposables = this._register(new MutableDisposable()); const openUserSettingsEditorWhen = ContextKeyExpr.and( ContextKeyExpr.or( ResourceContextKey.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()), ResourceContextKey.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())), ContextKeyExpr.not('isInDiffEditor')); const registerOpenUserSettingsEditorFromJsonAction = () => { registerOpenUserSettingsEditorFromJsonActionDisposables.value = registerAction2(class extends Action2 { constructor() { super({ id: '_workbench.openUserSettingsEditor', title: OPEN_USER_SETTINGS_UI_TITLE, icon: preferencesOpenSettingsIcon, menu: [{ id: MenuId.EditorTitle, when: openUserSettingsEditorWhen, group: 'navigation', order: 1 }] }); } run(accessor: ServicesAccessor, args: IOpenSettingsActionOptions) { args = sanitizeOpenSettingsArgs(args); return accessor.get(IPreferencesService).openUserSettings({ jsonEditor: false, ...args }); } }); }; registerOpenUserSettingsEditorFromJsonAction(); this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => { // Force the action to check the context again. registerOpenUserSettingsEditorFromJsonAction(); })); const openSettingsJsonWhen = ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_JSON_EDITOR.toNegated()); registerAction2(class extends Action2 { constructor() { super({ id: SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON, title: { value: nls.localize('openSettingsJson', "Open Settings (JSON)"), original: 'Open Settings (JSON)' }, icon: preferencesOpenSettingsIcon, menu: [{ id: MenuId.EditorTitle, when: openSettingsJsonWhen, group: 'navigation', order: 1 }] }); } run(accessor: ServicesAccessor) { const editorPane = accessor.get(IEditorService).activeEditorPane; if (editorPane instanceof SettingsEditor2) { return editorPane.switchToSettingsFile(); } return null; } }); } } </ins> const workbenchContributionsRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench); workbenchContributionsRegistry.registerWorkbenchContribution(PreferencesActionsContribution, LifecyclePhase.Starting); workbenchContributionsRegistry.registerWorkbenchContribution(PreferencesContribution, LifecyclePhase.Starting); <ins> workbenchContributionsRegistry.registerWorkbenchContribution(SettingsEditorTitleContribution, LifecyclePhase.Restored); </ins> registerEditorContribution(SettingsEditorContribution.ID, SettingsEditorContribution, EditorContributionInstantiation.AfterFirstRender);