Can you anyone provide the shortcut for collapse all files in visual studio code explorer?
I personally prefer not to create new shortcuts. As #Mark pointed out on the answer of #JayChase there is an existing shortcut, but it requires the explorer to be in focus. Therefore I combine the shortcut mentioned by #JayChase with another standard shortcut, to get the desired behaviour.
command + 0 (focusses on explorer).
command + left-arrow
An additional benefit over this approach is that I usually want to focus on the explorer view if I want to collapse the folders.
Open the Keyboard Shortcut by pressing Ctrl + K then Ctrl + S and search for Collapse, you will see the Collapse Folders in Explorer key binding (It is empty by default). Press the + button to add your desired key binding.
Now you can enjoy your shortcut.
it's cmd/ctrl + shift + up-arrow
You can collapse all folders using cmd/ctrl left-arrow.
First, click anywhere in the explorer window to activate it, then use the shortcut.
On Windows and Linux.
Ctrl + Left arrow
On Mac:
⌘ + Left arrow
When the Explorer is active, you could use the Workbench list based shortcuts. list based shortcuts include collapse, collapse all, expand, expand all, toggle expand/collapse
To see what are the shortcuts open Keyboard Shorcuts -> Search for list. . Here you find shortcuts for collapse, collapse all, expand, expand all, toggle expand/collapse. These shortcuts work when the Explorer is active, as the Explorer works as a list.
Below is a screenshot for Mac.
If you would like to define a shortcut, without activating the Explorer, then I would recommend - cmd+k ctrl+c. You could add this by opening Keyboard Shorcuts -> Search for Collapse Folders in Explorer -> Click the edit button after hovering over the the Command you want to edit.
Related
In Eclipse there is Ctrl + O shortcut for quick outline, which lets explore class attributes and methods with incremental search
Is there equivalent shortcut in Visual Studio 2017?
Probably you need a Class Veiw (from View or Ctrl+Shift+C). Or the bar at top of edit window.
Or,
Basically you don't need shortcuts. After you type the dot this list drop automatically. But Ctrl+Space do the same.
Also, you can open a definition in the 'Peak View', by Ctrl + click:
Or open Code definition window (from View or Ctrl+Shift+V)
Keyboard command you want is Window.MovetoNavigationBar as can be seen in Default keyboard shortcuts in Visual Studio. Its shortcut is CTRL+F2, though in Visual Studio / Tools / Options it's asociated with ALT+Home. Both work for me.
Once in Navigation Bar, you actually have three separate combo-boxes between which you can navigate using TAB key. The third one is the Eclipse Outline lookalike.
Unfortunately, it's easier to do this via mouse, as there is no direct shortcut to the last combo-box.
You can use Go To Members option using (Alt + \) shortcut. If it is listing all the members across the project, you may want to scope it to current document (Ctrl + Alt + C)
I was trying to figure out how to toggle the side bar, and apparently ctrl + b is the way to do it, but when I perform it, it opens up the that input bar in the middle of the top portion of the editor, just below the menu bar, with "edt " (including the space) typed in.
My keybindings.json file shows that I should ctrl+b should indeed toggle the side menu.
If I delete the "edt " and press ctrl+b, it just regenerates it.
Anyone know how to fix this? Nothing shows up on Google either.
ctrl + b is bound to Add Function Breakpoint by default. You can edit the shortcuts from File->Preferences->Keyboard Shortcuts.
File > Preferences > Keyboard Shortcuts will show you a list of shortcuts.
You can search for Toggle Side Bar Visibility or workbench.action.toggleSidebarVisibility to see what the current shortcut bindings are, and edit them.
Mine were also showing the edt behavior you described, and were set to accept Ctrl + \ as well as Ctrl + K Ctrl + B for toggling the side bar visibility. Ctrl + \ may be worth trying out if you do not want to go through the hassle of finding a new non-clashing key combination to set as the shortcut.
If you see edt, it is because ctrl+b is bound by default to View: Show All Editors By Appearance.
As others have mentioned, use File > Preferences > Keyboard Shortcuts (or find it in the command palette with ctrl+p), then search for "Show All Editors By Appearance" and remove that key binding.
You may also remove any other ctrl+b bindings there, if they're in your way by searching for "ctrl+b".
Ctrl+B is normally worked in toggling sidebar in Visual Code, but some extensions prevent it, because ctrl+b is used in these extensions as a shortcut.
To solve this problem:
You should go to
File > Preferences > Keyboard Shortcuts
and then, you will change the shortcuts used as ctrl + b
View: Toggle Side Bar Visibility
This is an extremely stupid question... but how do I close/toggle the search box in vscode?
I hit [ cmd + shift + f ] to do a global search, but then I need to reach for my mouse to actually close the box to allow for more screen space.
I've searched through their issues, and there seems to be another user in the past who also experienced something similar --> https://github.com/Microsoft/vscode/issues/32613 , but the solution provided of cmd - b only works for closing the sidebar.
My developer speed has drastically dropped since this issue, and I'm certain there's been a fix.
Please help. :(
**added in picture here -->
Press CTRL + SHIFT + E. It will switch to and focus the explorer.
Your search results are appearing in the panel, not the sidebar.
To toggle the panel:
pc/mac: ctrl + ` (backtick)
mac: ⌘ + J
However, if you want your search results to appear in the sidebar (which I think is the default behavior), then add this line to your settings:
"search.location": "sidebar"
Similar to what Vijey has mentioned, you can use the Toggle Panel keyboard shortcut which will do the job for me. On A mac the shortcut is
⌘ Command+J
I'm coming from sublime where the search results appear in a new tab - making it much easier to close the results (just like closing an other tab)
The best way to get rid of the search panel is by doing the following: -
On a windows computer, press and hold CTRL + Q
A window will then pop up, you can then release Q when the window pops up but you still have to hold down the CTRL key to keep the pop up open
3.Now use your mouse to click on the option called explorer and the search menu is now gone
There is no keyboard shortcut to close the search panel. However, you can create a shortcut yourself as shown in the attached image.
1) Go to File > Preferences > Keyboard Shortcuts.
2) Search for the command 'Close Panel' and set it to your convenient keyboard shortcut.
In the image below, I set it to Ctrl+F8.
If the search box displays in the sidebar (see Amr Noman's answer on how to set that up if it isn't already), How do you close the search box and go back to your project folders? In this case, there is no tab you can close with a click of the mouse. One way is to set up a keymap shortcut, e.g.
{
"key": "cmd+'",
"command": "workbench.files.action.showActiveFileInExplorer"
},
You can figure this out by going to Preferences -> Keyboard Shortcuts and searching for sidebar. One of the hits is described as "File: Reveal Active File in Side Bar"
More generally, any action that hides your project folder view in the sidebar can be cancelled by this shortcut.
I'm wondering if there is a shortcut for VS Code that highlights in solution explorer tree current opened file. Like we have in Visual Studio:
Alt + Shift + L
Couldn't live with no complete answer, so figured out the following:
Without a direct keyboard shortcut:
Open the command palette via Cmd-Shift-P (or Cmd+P then >) and type Files: Reveal Active File in Side Bar.
This reveals the active file in the side bar similar to Visual Studio's Alt+Shift+L
Then, take the above and map a keyboard shortcut to it:
Open keyboard shortcut preferences file via Cmd-Shift-P followed by Preferences: Open Keyboard Preferences File.
Add in the following (taking Visual Studio's lead, I've personally mapped it to Alt+Shift+L, but map to what you want).
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "shift+alt+l",
"command": "workbench.files.action.showActiveFileInExplorer",
},
]
Note that it's not as good as Visual Studio, Atom, etc. in that you can't then navigate with arrow keys in the tree (arrow keys navigate the active file contents), but I guess I'll eventually figure out how to do that.
#Tomoyuki Aota points out that you can do the following to navigate with arrow keys:
After Files: Reveal Active File in Side Bar, press Ctrl+Shift+E (Show
Explorer). After that, I can navigate the files in the explorer by the
arrow keys.
I don't think there's a command for that, but there is a shortcut to enable/disable revealing the current file as you open it:
"explorer.autoReveal": true
Try this:
Together with #Rob's correct answer:
"explorer.autoReveal": true
then Ctrl-Shift-E (Show explorer) focuses that file in the explorer and the arrow keys will navigate up/down/left/right like any list. This works even if the explorer is closed prior to the Ctrl-Shift-E.
Ctrl-Shift-E has the added bonus in that it will toggle focus between the highlighted file and its editor as well.
For mac, use Cmd-Shift-E
Right-click the file tab (not necessarily current one) and click "Reveal in Side Bar".
I was able to achieve this by customizing the workbench.files.action.focusFilesExplorer command with keybinding Alt + shift + L
Open the Keyboard Shortcuts ctrl + K + shift + S
search for focusFilesExplorer command & customize
Provide your keybindings that you are used to - I set mine to Alt + Shift + L
F1 then type "reveal" also works from in VS Code, at least for me.
It looks like the actual version of VS Code offers a command for this feature now.
In the settings, type revealInExplorer in the search bar to find the command. There is no default keybinding, so just put your own. Works like a charm!
Download the open in browser extension, that's it.
Right click > Open in primary/secondary browser function appears, and the ALT+B / ALT+SHIFT+B shortcuts become available.
Had a similar case and ended up here looking for help.
I opened a file in "preview" mode after clicking a link in a .md file and wanted to know where this opened file was located in the project.
I found this button in the upper right corner of VS Code which was exactly what I wanted:
It's called "show source"
Also check "Explorer: Auto Reveal Exclude" patterns in VS Code settings. Files that fit any of the patterns will not be auto revealed in the Explorer tree.
Eclipse has an MDI structure (Multi Document Interface), so the search panel, the package explorer and the code editor can all be open in one window, but I haven't found a keyboard shortcut for switching between these panels. For example, after I search the code-base, I would love to have a quick shortcut for going back to the code editor.
If I understand your question correct, you are probably looking for Ctrl + F7 and Ctrl + Shift + F7. Other navigational shortcuts can be found in the menu: Window > Navigation.
Not an universal shortcut for going to any panel, but:
Ctrl+Shift+E
allows you to go back to any Editor (although it's still a little heavyweight for quick editor navigation).
And if you want to switch between perspectives its: Crtl + F8 and Ctrl + Shift + F8. You can go to Help > Key Assist... for a full list of shortcuts (this list will change depending on the active editor etc.).
There are two ways to do it.
One is how #VonC did it, in an earlier reply; using CTRL+SHIFT+E which opens a box containing all the panes with their paths.
The other one is to simply use CTRL+E, which will open a pop-up just over your cursor containing the list of panes open. Parse using arrows and ENTER