VS Code: Multiple Project Folders

Hi,

You’ve successfully launched VS Code in no-extensions mode, as shown in your screenshot. That’s exactly what we needed.

Now, let’s keep things focused. Close everything down, then repeat what you just did:
open a terminal, run code --disable-extensions, and once VS Code opens — don’t jump around, just go straight to File → New Window.

Then, before anything else, make sure the Explorer pane is visible (press Ctrl+B if needed).

After that, use File → Add Folder to Workspace… and select your TestProject folder.

Let me know what shows up in the Explorer pane at this point. A screenshot would be helpful.


Re. a new installation, I mean yeah, why not? Reinstalling only takes a few minutes and might solve all your issues in one go.

Things to be aware of though are that you will lose all your extensions and settings and even then, there is a chance that VS Code “helpfully” holds on to some remnants of your profile.

If it were me, I would first try installing on a different Windows device and making sure that you can add folders to a workspace as we have described here in this thread. That would prove that your current installation is broken. At that point I would then look at removing and then slowly recreating your profile within your current install of VS Code so as to see what exactly caused it to break.

That said, it would be nice to get to the bottom of whether an extension is causing things to go wrong first.

1 Like

G’day, James!
OK I did the following:
a) Restarted Windows and allowed a pending update to proceed.
b) Started Firefox
c) Shut tasks down except Task Mgr and Firefox
d) Opened Command Prompt and entered “code --disable-extensions”
e) Got immediate VS Code screen showing last files open, without loading VSC
f) Went straight to File > Add Folder to Workspace and selected TestProject folder
g) Got this screen:

There are persistent options somewhere that don’t get flushed. Is that the VSC profile you spoke of?

I used Perplexity to ask about persistent files and got this response:

Yes, Visual Studio Code (VS Code) maintains persistent files that store information for the next load. Specifically:

  • VS Code stores user and workspace settings in JSON files named settings.json. User settings are stored in a platform-dependent location such as %APPDATA%\Code\User\settings.json on Windows, $HOME/Library/Application Support/Code/User/settings.json on macOS, and $HOME/.config/Code/User/settings.json on Linux. Workspace settings are stored inside a .vscode folder within the project root folder, allowing project-specific settings to persist and be shared among users of that project1234.
  • Besides settings, VS Code has a “Hot Exit” feature that preserves unsaved files and their contents when the editor is closed, so that these files are restored on the next launch. The data for unsaved files is stored in a Backups folder within the user data directory (e.g., ~/.config/Code/Backups on Linux). This ensures that unsaved changes are not lost between sessions68.
  • VS Code also supports syncing settings, extensions, and other preferences across machines, keeping local and remote backups of these configurations. These backups are stored persistently and can be restored if needed9.

In summary, VS Code uses persistent JSON files for settings and a backups directory for unsaved files to maintain state across sessions, enabling the editor to restore your environment on the next load. This persistence applies to user settings, workspace/project settings, and unsaved file contents[1]

Based on the above, I wonder if a fresh install will work unless those settings are deleted first. I wonder what downsides (if any) there would be to deleting “%APPDATA%\Code\User\settings.json” before reinstalling?

Thanks — we’re getting close. But I think you missed one step.

After launching VS Code with --disable-extensions, you went straight into a session with your last open files. That means you were still in a restored workspace or single-folder mode.

What you need to do is, once VS Code opens, go to File → New Window. That gives you a clean, empty session. From that window, use File → Add Folder to Workspace… and select your TestProject folder.

Here are the steps again:

  1. Close all open VS Code windows.
  2. Open Command Prompt.
  3. Run: code --disable-extensions
  4. When VS Code opens (you’ll see your last session), go to File → New Window ← this is the step you missed before.
  5. In the new window, press Ctrl+B if the Explorer isn’t showing.
  6. Go to File → Add Folder to Workspace… and select your TestProject folder.
  7. Look at the Explorer pane — let us know what shows up, and post a screenshot of that window.

I’m not sure how much of a difference this extra step will make, but it’s worth checking before going on to the next steps.

1 Like

I may have missed it, but did you click the “…”, in explorer?, and see if Folders is selected.

1 Like

Here’s brief recap of the last attempt.

  1. closed all apps

  2. ended tasks in TM

  3. opened firefox to sitepoint.com

  4. opened EditPadLite to record steps

  5. opened new command prompt and entered code --disable-extensions; VSC opened on its own without content

  6. File > New Window

  7. File > Add Folder to Workspace TestProject; nothing

  8. tried same again nothing

  9. File Open Folder TestProject

I can only conclude that the settings.json file is somehow ‘corrupted’ and causing unexpected, unpredictable results. What to you think of the idea of closing VSC then deleting the settings.json file then loading VSC code again, which should bring in a default settings file, should it not?

Try what @Zensei suggested first — open the Explorer pane, click the …, and make sure “Folders” is checked. Does that make any difference?

If that still doesn’t sort it, the next step would be to rename your VS Code profile folder. That way, you can test with a clean slate but still keep everything safely backed up.

Here’s how:

  1. Close VS Code completely.
  2. Open File Explorer and type this into the address bar:: %APPDATA%\Code
  3. Rename the Code folder to something like Code_backup
  4. Start VS Code again — it’ll recreate everything from scratch.
  5. Open a new window and try File → Add Folder to Workspace… with your TestProject folder.

If that fixes it, you’ll know the issue was buried somewhere in your profile data. And if not, you can always close VS Code, delete the new Code folder, and rename Code_backup back to Code to restore everything.

1 Like

I repeated afresh the steps outlined in previous post. Then I clicked the “…” and got these results.

Does that answer your question Zensei? What do my results tell us?

Note that this result was after attempting to open the TestProject folder using File > Add Folder to Workspace

It seems that I can only open a single folder at a time and can that only after opening VS Code and choosing File > Open Folder and selecting the folder of choice. Having done so the Explorer Pane displays all the file names withing the chosen folder but none of the subfolder names. In my early use of VSC I recall that after opening a folder its subfolders were displayed and clicking them in the Explorer Pane then caused the files within them to display. It was my practice then to have 3 subfolders in a project: Styles (for CSS file); HTML (for index et al); and JS (for javascript). My HTML href ‘calls’ to CSS contained “Sytles/filename.css” as my img src ‘calls’ to images include “images/imgfilename.jpg”.

I’m still at sea.

UPDATE: (scroll to end)

I renamed the “Code” subfolder and then loaded VSC (after checking in Task Mgr that it was not running). I was able to File > Add Folder to Workspace > TestProject and actually see the folder and its subfolders in the Explorer Pane (after clicking the margin icon to open the Explorer Pane).

Thus encouraged, I closed the TestProject folder then chose File > Add Folder to Workspace > HutchinsClan (my development folder) with this result:

I was surprised to see that the title bar doesn’t reflect the name of folder as the workspace title. I was pleased to note that subfolders and their contents are not accessible from the Explorer Pane. I checked and found that my 4 extensions were still applied; ergo, extensions must be linked in some manner not associated with APPDATA…Code path.

I then thought to try having multiple projects open by using File > Add Folder to Workspace > another project. The second project opened as the ss shows, but I can’t find a way to navigate between the 2 open projects. Sigh, so much to learn.

For now I’m a happy camper. James, I cannot thank you enough for walking me through this. I learned a lot that I would not have had I just ham-fistedly deleted the settings.json file.

UPDATE:
I used AI to ask how VS Code chooses what to put in the Workspace title bar and learned there is a setting in settings.json (window.title). I returned to VS Code intent on making a settings change to cause the active folder name to appear when I discover a flag to install an update. I did so (to 1.100.3) and upon completion discovered that the Explorer pane shows both open folders; so I can now work between them with ease. THIS IS GREAT!!!

This is how I did it.

Now I click “Open Folder”

I opened my “APP_LOGGER” folder. So I got this:

Notice in Explorer I have, let’s call it two panes. Open Editors and APP_LOGGER.

I make sure my APP_LOGGER pane is selected. (You should see a blue line around the pane.

Right mouse click and select “Add Folder to Workspace”, select another folder

Now I have app_logger and local_db folders in UNTITLED(WORKSPACE)

1 Like

Thanks, Zensei.

I am now on a similar path wrt to how multiple projects display. (See updates to my post).

I now strongly suspect that I somehow corrupted my settings.json file. Now that I’ve forced a new path thus forcing a new settings file (thanks to James), I think I’m back where I need to be. One good lesson learned is to be very careful making changes o the settings.json file. :upside_down_face:

1 Like

Brilliant — that’s great to hear! It sounds like everything finally clicked into place for you :+1:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.