How to "close"/"disable" root folder temporarily without removing it from workspace in VS Code?

52 Views Asked by At

Do you guys know the way to disable certain folders temporarily (to exclude them from searches, only see the git repo linked to open folder, only run Java build task with open folder etc.), but without removing it from workspace and still show up on the list of folders, so it can easily be re-enabled.

If you have the similar situation and no good solution, please upvote the feature request at: https://github.com/microsoft/vscode/issues/182803

Only way for now is to remove the folder from VScode completely.

1

There are 1 best solutions below

2
starball On

You can temporarily edit the workspace settings' search.exclude setting to exclude paths from search functionality. It's not an ideal solution especially if you track the workspace settings in version control, but it's a workaround. If you want to "ignore" things at a deeper level, use the files.exclude setting.

Unfortunately, files.exclude does not seem to affect the SCM View. You can right click repositories there and select "close repository" and then later reopen then using the Git: Open Repository or Git: Reopen Closed Repositories commands in the command palette.

If you're using the Search View, you can expand the search details and edit the "files to include" and "files to exclude" fields, which take comma-separated lists of glob patterns.