Change:
I am forming an openEditorAtIndex command using the following syntax: '' + index 1-9 work correctly (and are default keybindings already). Would it be possible to add support for any index? I currently need to use this command if <= 9 and if 9, I have to go to index 9 and then next count - 9 times to get to the desired pane with a risk of wrapping around
trying to understand the scenario here, I do not think it makes sense for VSCode to introduce commands for more indices because this number is pretty much unlimited. Can we have another command that just goes to the next index, from the current one and you could use that instead? E.g. does it work if you use ?
Lines 55 - 89 are what I use to be able to go to any tab My case here is what I am trying to avoid Ideally I could do and never think twice about it The problem with using nextEditorInGroup is that I have no way of knowing the max editor number index, so if I say go to tab 10 and there are only 8 tabs, the current logic will try to go to tab 9 with the absolute exposed command, then use a nextEditorInGroup command.
that switch-case statement looks quite horrible, an alternative would be for the workbench to expose a command where you just pass the index as argument into. We already have that for other commands, e.g. see the "move editor command" () Would that be better?
That would work for me too! It is not very urgent since I don't think people navigate to tabs they can't see very often but for completeness it would be nice! Thanks!
Great. I would accept a reasonable small PR on this feature request.
I'll try to write a reasonable small PR for this :)
landed, thanks to
Some steps so I do not have to read the whole discussion? What command with what arguments should do what now?
here you go: write an extension that executes and verify the tab at that index opens.
Works nicely. Though the counting starts from - might be a bit confusing.
Ah yeah good point, but I think that is fine.

Discussion:
import { IEditorGroupsService, IEditorGroup, GroupDirection, GroupLocation, GroupsOrder, preferredSideBySideGroupDirection, EditorGroupLayout } from 'vs/workbench/services/group/common/editorGroupsService'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; <del> import { CommandsRegistry } from 'vs/platform/commands/common/commands'; </del> <ins> import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; </ins> import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; export const CLOSE_SAVED_EDITORS_COMMAND_ID = 'workbench.action.closeUnmodifiedEditors';

export const NAVIGATE_ALL_EDITORS_GROUP_PREFIX = 'edt '; export const NAVIGATE_IN_ACTIVE_GROUP_PREFIX = 'edt active '; <ins> export const OPEN_EDITOR_AT_INDEX_COMMAND_ID = 'workbench.action.openEditorAtIndex'; </ins> export interface ActiveEditorMoveArguments { to?: 'first' | 'last' | 'left' | 'right' | 'up' | 'down' | 'center' | 'position' | 'previous' | 'next'; by?: 'tab' | 'group';

} function registerOpenEditorAtIndexCommands(): void { <ins> const openEditorAtIndex: ICommandHandler = (accessor: ServicesAccessor, editorIndex: number): void => { const editorService = accessor.get(IEditorService); const activeControl = editorService.activeControl; if (activeControl) { const editor = activeControl.group.getEditor(editorIndex); if (editor) { editorService.openEditor(editor); } } }; // This command takes in the editor index number to open as an argument CommandsRegistry.registerCommand({ id: OPEN_EDITOR_AT_INDEX_COMMAND_ID, handler: openEditorAtIndex }); </ins> // Keybindings to focus a specific index in the tab folder if tabs are enabled for (let i = 0; i < 9; i++) {

const visibleIndex = i + 1; KeybindingsRegistry.registerCommandAndKeybindingRule({ <del> id: 'workbench.action.openEditorAtIndex' + visibleIndex, </del> <ins> id: OPEN_EDITOR_AT_INDEX_COMMAND_ID + visibleIndex, </ins> weight: KeybindingWeight.WorkbenchContrib, when: void 0, primary: KeyMod.Alt | toKeyCode(visibleIndex), mac: { primary: KeyMod.WinCtrl | toKeyCode(visibleIndex) }, <del> handler: accessor => { const editorService = accessor.get(IEditorService); const activeControl = editorService.activeControl; if (activeControl) { const editor = activeControl.group.getEditor(editorIndex); if (editor) { return editorService.openEditor(editor).then(() => void 0); } } return void 0; } </del> <ins> handler: accessor => openEditorAtIndex(accessor, editorIndex) </ins> }); }