Maintain editor category and step when no walkthrough found (#189873)

* Maintain editor category and step when no walkthrough found

* Remove unused import
This commit is contained in:
Bhavya U
2023-08-07 16:35:51 -07:00
committed by GitHub
parent d0ff4f5353
commit 356a0ecb3e
2 changed files with 7 additions and 12 deletions
@@ -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: <GettingStartedEditorOptions>{ selectedCategory: selectedCategory, selectedStep: selectedStep, preserveFocus: toSide ?? false }
}, toSide ? SIDE_GROUP : undefined);
});
}
} else {
editorService.openEditor({ resource: GettingStartedInput.RESOURCE });
@@ -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;
}
}
}