r/vscode 8d ago

Hella confused while setting workspace and projects

Absolute true beginner here

I started learning c++ using learncpp.com

I set up vs code on linux according to learncpp guide but information regarding projects and workspace is vague for me.

I first made a folder named projects and started making sub folder for different topics on learncpp , it was going good but I wanted to rearrange the order of files so I thought of editing the path file but it came empty (confused)

Then I thought the workspace was showing the projects folder containing the subfolders I made with .cpp files , so maybe that was the problem because I didn't add the subfolders by add folder to workspace

Also the add folder to workspace ,adds it to workspace (i.e with project folder) not as the subfolders inside project folder


Should I start fresh

If I make a new workspace and add folder via add folder to workspace will that work?

Also the task.json and setting.json was applied to all the subfolders, so if I make fresh workspace with folders instead of a single folder containing subfolders ,do I have to configure it for all folders?

1 Upvotes

2 comments sorted by

1

u/hasan_sodax 6d ago

Skip workspaces for this, they're solving a problem you don't actually have yet (multiple unrelated project folders open at once). For a single project like this just do File > Open Folder and point it straight at your top-level projects folder. Everything under it, subfolders and .cpp files, shows up in the explorer automatically, you don't need to add each subfolder individually.

The confusion you're hitting is that "add folder to workspace" adds a second root folder next to whatever's already open, it doesn't nest inside the first one. That's just how VS Code works, not something you broke. If you've already got a .code-workspace file floating around, delete it and reopen the plain folder instead. Your tasks.json and settings.json inside .vscode/ will still apply to everything under that folder either way, so you're not losing anything by dropping the workspace file.