Binding multiple projects and nested projects

Please provide

  • Operating system: MacOS Sequoia 15.3
  • Visual Studio version: 1.97.0
  • SonarQube for Visual Studio plugin version: 4.15.0
  • Programming language you’re coding in: Python
  • Is connected mode used: Yes
    • SonarQube Cloud

And a thorough description of the problem / question:
I wonder how I can bind multiple projects with SonarQube for IDE with VSCode. Here is my case: I have a project directory, called project-A (which is a github repository that binds with project-A on SonarCloud). Inside project-A, I also have a separate project, called project-B (another github repository that binds with project-B on SonarCloud).
If I want to bind project-A directory with project-A on SonarCloud, and project-B directory with project-B on SonarCloud in my VSCode, how can I do that? I’m only allowed to create 1 connection when clicking “Add SonarQube Cloud Connection”. Thus, I can’t create 2 different connectionIds for 2 projects.
I have tried:

project-A/
--.vscode/settings.json
--projectB/
  --.vscode/settings.json

and the content of the settings.json

// In project-A/.vscode/settings.json
{
    "sonarlint.connectedMode.project": {
        "connectionId": "mySonar",
        "projectKey": "project-A-key"
    }
}

// In project-B/.vscode/settings.json
{
    "sonarlint.connectedMode.project": {
        "connectionId": "mySonar", // I can't create another connectionId for the nested project via VSCode
        "projectKey": "project-B-key"
    }
}

Please give me some guidance on this or let me know if this is possible. Thank you!

Hello, welcome to the community! And thank you for asking.

I would recommend creating a multi-root workspace.

You can start with your current project-A folder open, then use File > Add Folder to Workspace... to add project-B as a separate workspace folder.

You can then use File > Save Workspace As... to save this workspace layout and have it automatically reopened the next time you start the IDE.

This way, each workspace folder is seen by the IDE as a separate configuration scope, and each can be bound to a different project on SQ:Cloud.

1 Like