Visual Studio Code and subfolder-specific settings

I also couldn’t find a decent answer for this, I did find an “hacky” workaround. I have the following project structure:

.
├── apps
│   ├── api
│   │   ├── Dockerfile
│   │   ├── .gitignore
│   │   ├── hhapi
│   │   ├── manage.py
│   │   ├── .pylintrc
│   │   ├── requirements.txt
│   │   ├── venv
│   │   └── .vscode
│   └── crawler
│       ├── crawler-crontab
│       ├── Dockerfile
│       ├── .gitignore
│       ├── hhcrawler
│       ├── .pylintrc
│       ├── requirements.txt
│       ├── .scrapy
│       ├── scrapy.cfg
│       ├── venv
│       └── .vscode
├── docker-compose.development.yml
├── docker-compose.production.yml
├── .gitignore
├── .gitlab-ci.yml
├── househunter.code-workspace
└── .vscode
    └── settings.json

What I ended up doing was ignoring the apps directory on the project root and then add both apps to the workspace.

So the ./.vscode/settings.json looks like this:

{
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "apps": true
      },
}

And the househunter.code-workspace file like so:

{
    "folders": [
        {
            "path": "apps/api"
        },
        {
            "path": "apps/crawler"
        },
        {
            "name": "root",
            "path": "."
        }
    ],
    "settings": {}
}

This is what I see on the editor:

project structure on visual studio code explorer

And it is indeed following the subprojects settings.json. This is far from being a great solution, but for the time being was the only way I found to achieve this – I’d also love to see someone document a proper solution for this. 🙂

Leave a Comment

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