Billy ONeal
Billy ONeal

Reputation: 106609

How do I put multiple unrelated folders into a Visual Studio Code workspace?

I have a tree of more than 100GB of sources I work in that looks like this:

$/unrelated
$/tests/my-team/tests.config
$/tests/my-team/tests/test/test.cpp
$/tests/my-team/tests/test2/test.cpp
$/tests/unrelated
$/unrelated
$/product/my-team/product.config
$/product/my-team/foobar.h
$/product/my-team/foobar.cpp

My team only works with a very small subset of these. I would like Visual Studio Code to show only these:

$/tests/my-team/*
$/product/my-team/*

and not index / search other directories. Is this possible?

Upvotes: 0

Views: 75

Answers (2)

Patrick Callahan
Patrick Callahan

Reputation: 11

Create a multi-root code-workspace file and start VSCode with it:

You can either do this directly:

{
    "folders": [
        {"path": "/tests/my-team"},
        {"path": "/product/my-team"}]
}

Or indirectly, by creating a folder with symbolic links to the folders of interest and starting VSCode in that folder.

Upvotes: 0

Hhut
Hhut

Reputation: 1198

You could add a .vscode/settings.json (File - Preferences - Workspace Settings) to your workspace and add:

// Place your settings in this file to overwrite default and user settings.
{
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true
        "unrelated/**" : true
    },
}

This will (I believe) also exclude from... but you can specify that directly

"search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true,
    "unrelated/**" : true
},

Upvotes: 1

Related Questions