How to disable file auto-focus in VSCode Explorer panel when file is opened by navigating tabs?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)