From 356a0ecb3ecff69274f08b0ec1db7973a67ee2c4 Mon Sep 17 00:00:00 2001 From: Bhavya U Date: Mon, 7 Aug 2023 16:35:51 -0700 Subject: [PATCH] Maintain editor category and step when no walkthrough found (#189873) * Maintain editor category and step when no walkthrough found * Remove unused import --- .../browser/gettingStarted.contribution.ts | 4 ++-- .../browser/gettingStarted.ts | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts index 074ecfeb359..a6da647dbcc 100644 --- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts +++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts @@ -10,7 +10,7 @@ import { EditorExtensions, IEditorFactoryRegistry } from 'vs/workbench/common/ed import { MenuId, registerAction2, Action2 } from 'vs/platform/actions/common/actions'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ContextKeyExpr, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeyCode } from 'vs/base/common/keyCodes'; import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor'; @@ -106,7 +106,7 @@ registerAction2(class extends Action2 { editorService.openEditor({ resource: GettingStartedInput.RESOURCE, options: { selectedCategory: selectedCategory, selectedStep: selectedStep, preserveFocus: toSide ?? false } - }, toSide ? SIDE_GROUP : undefined); + }); } } else { editorService.openEditor({ resource: GettingStartedInput.RESOURCE }); diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts index a371f7fa64f..04283236ddd 100644 --- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts +++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts @@ -851,16 +851,11 @@ export class GettingStartedPage extends EditorPane { if (!this.currentWalkthrough) { this.gettingStartedCategories = this.gettingStartedService.getWalkthroughs(); this.currentWalkthrough = this.gettingStartedCategories.find(category => category.id === this.editorInput.selectedCategory); - } - - if (!this.currentWalkthrough) { - console.error('Could not restore to category ' + this.editorInput.selectedCategory + ' as it was not found'); - this.editorInput.selectedCategory = undefined; - this.editorInput.selectedStep = undefined; - } else { - this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep); - this.setSlide('details'); - return; + if (this.currentWalkthrough) { + this.buildCategorySlide(this.editorInput.selectedCategory, this.editorInput.selectedStep); + this.setSlide('details'); + return; + } } }