visual-studio-code

How to select a folder in VS Code's explorer view without expanding or collapsing it?


In Visual Studio Code, if you want to add a new file or folder under an existing folder, you need to first select it. However, selecting a folder will cause it to toggle between expanded and collapsed, which can be bothersome because it often makes you need to click the folder twice and because it can cause the file list to scroll around. Sometimes I want to select a folder that is already open without closing it. However, I have yet to find a way to do so.

Example:

I want to select pktest folder:
screenshot of pktest folder in Explorer, unselected and expanded

After selecting it, it gets collapsed and I need to open it again =(
screenshot of pktest folder in Explorer, selected but collapsed

Is it possible to select folders without collapsing or expanding them?


Solution

  • Right click -> New File/New Folder