How to navigate with VS code explorer
Asked Answered
Z

1

3

This is a question about the VS code explorer window navigation.

In the Windows Explorer application, I can instantly navigate down to any file that I choose. If the windows explorer window shows my folders or files in ascending name sequence, I can quickly select any of the entries below by typing the first letter of the file/folder that I'm looking for. For instance, if I type in "C", the selection instantly goes down to the first file/folder that begins with C. This has been the default Windows navigation for as far back as I can remember. So am I able to do this in the VS code explorer? My projects are rather long and having to scroll down to say the 50th(or 100th) file is kind of a pain. So is this feature or something like it available in VS code? The explorer window shows the file/folders in ascending sequence so this should be possible. If this is not a feature in VS code, what is the recommended way to navigate throughout the VS code explorer?

Zolazoldi answered 8/6, 2019 at 16:39 Comment(2)
I posted this question around 2 years ago. Has there been any updates to VS Code that adds functionality to the folder navigation?Zolazoldi
you can type the first a letter of a file/folder while in the explorer and vs-code now jumps to the first file which starts with this letterProdrome
E
2

See keyboard navigation in the explorer:

There are now three different types of keyboard navigation in trees: simple, highlight, and filter. In both highlight and filter, typing in a tree will display a widget (control) at the top of the tree, which indicates that you are now navigating the tree:

[see the demo at the link above.] So you can filter or highlight matching folders or files if you type which the explorer has focus.

Try this setting:

"workbench.list.keyboardNavigation": "filter" 
     // see other options under this setting: highlight and simple

and explorer will filter out all non-matching folders/files. I wish it would automatically open those folders with matching files within but it doesn't. The folder is highlighted or passes the filter but it doesn't open.

In this demo (using the filter setting), first I pressed Ctrl-Shift-E to get Explorer focus (or you could just click anywhere in the explorer) and started typing.

Escape will clear the search and return the full explorer tree.

keyboard navigation in the Explorer

Enyedy answered 9/6, 2019 at 2:42 Comment(4)
That pretty much does what I want. Many thanks. Is there a way to "anchor" the search so that if I have a folder with the name "temp test folder" and another with the name "test folder" and I type in "test" in the filter window, it will only show the folder named "test folder" and any other folder beginning with "test"?Zolazoldi
No, you are basically talking about regex-like abilities and the functionality is pretty simple at this point. Don't forget to check the answer as accepted if you found it helpful and accurate.Enyedy
in theory I liked it but I couldn't find workbench.list.keyboardNavigation in keyboard shortcutsEudocia
@RoyerAdames workbench.list.keyboardNavigation is a setting.Enyedy

© 2022 - 2024 — McMap. All rights reserved.