VSCode Workspace

VSCode Workspace – Manage multiple related Projects effectively

If you need to work on several different projects at the same time, especially when working with cross-project integration, managing the same project within a same workspace will be the time-effective practice. In this post, I will note some practices when working with VSCode Workspace, how to manage multiple projects effectively. Of course we can apply the same practice to other VSCode forks like Cursor IDE, Google Antigravity, etc.

Assume that we need to create an integration / bridge between 2 existing projects in different root folders. The following notes highlight some steps that we need to do in VSCode workspace. Be noted that we can use different approach like git submodule, but this post is targeting VSCode workspace users 😀

Use Multi-root VSCode Workspace

  • First, open a project root, and then add another project by File → Add Folder to Workspace…
  • Then, save it: File → Save Workspace As…

So after adding all projects to a workspace, we can search / replace among all of them, as well as can do many Tasks/Terminals for each of them as managing in separated projects.

Adjusting Project Name / Docker Ports (optional)

As we are going to work across projects, we do not want to have any unnecessary conflicts. So in case these projects are using dockers or running in the same ports, remember to adjust them so that all these projects can start simultaneously.

For me, as I prefer everything should be in docker containers, I normally use docker-compose.yml to pack projects’ containers. When I want to start them all at the same time, I need to adjust some port mapping to avoid starting up conflicts.

Utilizing VSCode Tasks

To avoid opening terminal in different projects to run repeated tasks like starting up, rebuilding, etc., we can utilize .vscode/tasks.json to define and run different tasks among projects. For me, I am too lazy to go to each folder to start docker-compose environment for all projects, so I define different tasks for each project, and also some tasks for both projects such as starting docker-compose for all projects, shutting down them, etc.

So I have some tasks as follows:
– Project 1 – Docker Compose up
– Project 2 – Docker Compose up
– BOTH – Docker Compose up

VSCode: Running Tasks

As above, I have a task called BOTH – Docker Compose up as follows so I can start both projects at the same time.

		{
			"label": "BOTH - Docker Compose Up",
			"type": "shell",
			"command": "docker-compose up -d && cd ../../project-2 && docker-compose up -d",
			"isBackground": false,
			"problemMatcher": [],
			"group": "start"
		}

So ater defining tasks (Can do by Cmd – Shift – P → Tasks: Configure Task), later on we can easily run them by accessing Run Task: Cmd – Shift – P → Tasks: Run Task

VSCode: Accessing Tasks

That’s all. Happy coding!

Similar Posts

  • Introduction to SAML

    General Concept Security Assertion Markup Language (SAML, pronounced “sam-el”) is an XML-based open standard data format for exchanging authentication and authorization data between parties, in particular, between an identity provider and a service provider. SAML is a product of the OASIS Security Services Technical Committee. SAML dates from 2001; the most recent update of SAML is from 2005. The single most important problem that SAML addresses is the web…

  • The 2013 SEO Checklist

    This article is got from the excellent one from [ClickMinded]. All links/refenreces are kept as it is. This SEO checklist covers the top 30 things you should consider when it comes to getting a new site live and into the search index. It has been updated for 2013. It uses a simple script to tally…

  • Google Ranking Factors – SEO Checklist

    Google Ranking Factor Checklist     1. Positive ON-Page SEO Factors   2. Negative ON-Page SEO Factors   3. Positive OFF-Page SEO Factors   4. Negative OFF-Page SEO Factors Notes for the Above Factors Brief Google Update List – Panda The Sand Box Sources There are “over 200 SEO factors” that Google uses to rank pages in the Google search results (SERPs). What are the search engine optimization…

Leave a Reply

Your email address will not be published. Required fields are marked *