This question already has answers here:
How do I stop VSCode from the Side Bar moving to the folder that the current file is in?
(3 answers)
Closed 2 years ago.
Is there a way to prevent VSCode from jumping all over the place when closing a tab? It jumps to the location of the selected tab, but this is very disorienting when opening various files to inspect within a lib.
This behaviour is controlled by the following setting:
"explorer.autoReveal": false
There is currently no setting for keeping the selected file in the explorer, but this one at least keeps the scroll position fixed and prevents the "jumping".
Update
In current versions, the same setting now keeps the selected file.
After you apply "explorer.autoReveal": false, as mentioned above, you can also set up
a shortcut to force show the current file in Explorer:
{ "key": "cmd+e", "command": "workbench.files.action.showActiveFileInExplorer" }
As commented in issue 23902 (Option to keep file selected in sidebar without forcing a scroll)
If set autoReveal to true, the jumping inside file explorer is confusing;
If set autoReveal to false, I have to use showActiveFileInExplorer keybinding or right click menu every time when switch between tabs
But with VSCode 1.46 (May 2020) you now have:
Explorer auto reveal focus without forcing a scroll
There is a new option focusNoScroll for the explorer.autoReveal setting.
When using this option, the Explorer will automatically select files when opening them but will not scroll to reveal them in the Explorer view.
Related
This question already has answers here:
I hide commandCenter, how can I reopen them
(2 answers)
Closed last month.
image of empty command centre
I right click toggled off various buttons from my command center - back, forward, search bar. How do I re-enable them?
right-clicking again only shows a toggle for the entire command center but the toggles for the above mentioned buttons have disappeared
You can configure Visual Studio Code to your liking through its various settings. Nearly every part of VS Code's editor, user interface, and functional behavior has options you can modify.
VS Code provides several different scopes for settings. When you open a workspace, you will see at least the following two scopes:
User Settings - Settings that apply globally to any instance of VS Code you open.
Workspace Settings - Settings stored inside your workspace and only apply when the workspace is opened.
To modify user settings, you'll use the Settings editor to review and change VS Code settings.
To open the Settings editor, use the following VS Code menu command:
On Windows/Linux - File > Preferences > Settings
On macOS - Code > Preferences > Settings
You can also open the Settings editor from the Command Palette (Ctrl+Shift+P) with Preferences: Open Settings or use the keyboard shortcut (Ctrl+,).
When you open the Settings editor, you can search and discover the settings you are looking for. When you search using the Search bar, it will not only show and highlight the settings matching your criteria, but also filter out those which are not matching. This makes finding settings quick and easy.
Right Click in that area and select Command center
Then Right Click on each element you don't want and select Hide
Edit
Found an issue talking about the command center disappearing
The solution is command: View: Reset All Menus
After you've close a tab in vscode, the most recently viewed tab gets focus. I would like to change that behavior to instead focus the tab to the right of the closed tab.
Is there a setting to change this?
This feature was added in release 1.31 in January 2019. From the changelog:
Closing order of editor tabs
A new setting workbench.editor.focusRecentEditorAfterClose allows you to change the order in which editor tabs are closed. By default, tabs will close in most recently used (MRU) order. Changing this setting allows closing tabs from right to left instead.
So adding "workbench.editor.focusRecentEditorAfterClose": false to your settings.json should give you the behaviour you want.
I wonder if there is a setting or a feature request should be submitted for the following:
Currently, if you pick a file from the project explorer, it goes into its own tab. If you have several tabs opened, as you focus any one of them, the file itself also gets focused in the project explorer.
For larger projects where you navigate through a lot of files in the project and open files here and there this could actually be a distraction - for some people it would be better not to focus the current file in the project explorer and not lose sight of the last file you actually opened and its neighbour-files.
Another scenario is when you debug a node.js app and need to debug repeatedly with F11 - a lot of times you could find yourself in some ultra-deep node_modules folder that takes over the whole project explorer - and you need to close this manually later to bring the project explorer to order.
To answer the first part, if you add this to your workspace or user settings, vscode will no longer automatically show the currently active file in the file explorer.
"explorer.autoReveal": false
To answer the second part, if you like to have the current file focused but you don't like having the explorer section expanded all over the place, there is a command that can help you. If you put something like this in your keybindings, then whenever you feel the explorer has become unruly you can use the keyboard command. It is also available in the command palette ("Files: Collapse folders in explorer") and there is an icon in the file explorer that looks like this: [-]
{
"key": "ctrl+shift+t",
"command": "workbench.files.action.collapseExplorerFolders",
"when": ""
}
I have also created an extension that can automate this.
You can use a param:
"explorer.autoReveal": "focusNoScroll"
Focus to file will not disabled, but it will work without scroll (that's clear from the param value). It is usefull sometimes.
In VSCode, if I have an editor window tab open and I click anywhere in that editor window, the selected file in the File Explorer changes to the file being edited. I would like to prevent that behavior. This is possible in Visual Studio, but I can't seem to find a similar setting in the preferences file of VSCode.
Can anyone provide some suggestions?
This has been added, see https://github.com/Microsoft/vscode/issues/14745.
Configuration is "explorer.autoReveal": false
You can't, at least not today. The only thing you can do, is keeping the scroll position when switching tabs. See this answer for the setting: VSCode prevent file Explorer from jumping
And here is the feature request on Github: https://github.com/Microsoft/vscode/issues/14745
(Feel free to add a "Thumbs Up" via Github Reaction at the top so the request gets more attention in the future, this increases the chances that it gets implemented sooner)
In Visual Studio Code, whenever I close a file, the next open file becomes active in the editor and the Side Bar moves to that file's location in the folder structure. This is usually not the behavior I want. I often want to open another file in the same location as the one I just closed, but now my Side Bar has shifted around to what could be a totally different place in a large project.
I like the behavior of the main Visual Studio product where the Solution does not automatically shift. Instead, if I want to see where in the solution a file is, I can use a keyboard shortcut to move there ("Find File in Solution"), instead of automatically moving there every time the active file changes.
Is there any way to change/disable this functionality in VSCode?
The is an option explorer.autoReveal in settings (either user or workspace) which controls if the explorer should automatically reveal files when opening them.
Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
Add a new "explorer.autoReveal": false setting to the User Settings document on the right if it's not already there. This is so you aren't editing the Default Setting directly, but instead adding to it.
Save the User Settings file.
in Version: 1.42.1
Open VS User Settings (Preferences > User Settings).
Search for "explorer auto reveal" without quotes.
Now uncheck the checkbox.
There is a new setting in v1.46 that will select the files in the explorer but not scroll to reveal them:
We have introduced a new value focusNoScroll to the
explorer.autoReveal setting. For this value Explorer will
automatically select files when opening them but will not reveal them.
from v1.46 release notes.
So that setting will highlight the active editor in the explorer but not scroll to it.