0

Couldn't find a command in the Keyboard Shortcuts list that focuses next or previous view in the explorer.

I know there are commands available to directly focus certain views (e.g npm.focus, timeline.focus, workbench.explorer.fileView.focus) but that would require binding a unique key for every view.

I need a shortcut to focus next/previous view in the list.

jaiguru
  • 23
  • 5
  • to give focus to a view there is a command, search the Key Binding GUI for the internal/package.json name of the view, bind that command to a key, example `Ctrl+0` – rioV8 May 20 '22 at 17:42
  • Yes, as i said that would require me to bind a key for every view, i want to have two shortcuts: Focus next, Focus prev just like in the panel you can jump between views – jaiguru May 20 '22 at 18:23
  • they could bound the same key to a different command based on a context value, search the context dictionary when the views have focus to see what is different – rioV8 May 20 '22 at 18:50
  • `workbench.action.nextSideBarView` and `workbench.action.previousSideBarView` – rioV8 May 20 '22 at 18:56
  • That command switches between Primary Sidebar views but i'm talking about the views inside Explorer: Open Editors, Files, NPM Scripts, Timeline etc. – jaiguru May 20 '22 at 19:34
  • Binding a command based on a context value is an option, however if the order changes i'll have to rebind it every time – jaiguru May 20 '22 at 19:39

1 Answers1

0

Switching Focus between Lists in the Sidebar

The TAB key is your best option.

You can't specify a specific list switch focus on, but you can cycle up & down the list.

  • To Toggle one Group "DOWN" use: TAB
  • To Toggle one Group "UP" use: SHIFT + TAB

To toggle through the groups list items, like open editors in the open-editors section, logged file-saves in the local history section, files in the file explorer, and/or the many other groups/sections available in the sidebar...

  • use the UP & DOWN Arrow Keys.

This is how all html lists work. VS Code is written in HTML FYI (you probably new that, but I threw it out there for clarity's sake). When interacting with a page that has been rendered from an HTML document, the TAB key will always switch focus between base elements, and will never cycle through an elements children. If you cycle through elements, such as an ordered list (<ol>), or an unordered list (<ul>), you can cycle through their list items (<li>) using the UP & DOWN Arrow Keys.

VS Code is no exception, in fact the entire editor can be cycled through using the keyboard. There are many disabilities that this functionality accommodates.

And FYI, your theme, if well developed, should highlight where focus is at. I find many developers will remove that highlighting to create the desired visual effect, but doing so is naive, as its there for a reason.

JΛYDΞV
  • 8,532
  • 3
  • 51
  • 77
  • Yeah Tab works however focus will also cycle through the small buttons in the pane header so you have to press it multiple times to get into the list, i'm looking for a solution to jump directly to the list from one pane to another with a single hotkey. – jaiguru May 26 '22 at 00:36