Suggestion: Versioning `sonarlint.connectedMode.project.projectKey` only

  • Operating system: Windows 11
  • IDE name and flavor/env: VSCode 1.121.0 (user setup)

Following Connected mode setup | VS Code | Sonar Documentation, it is possible to bind local projects to any connected SonarQube server.

At the end of the process, the project’s settings.json file is edited/created to include the following:

{
	"sonarlint.connectedMode.project": {
		"connectionId": "<connectionId>",
		"projectKey": "<projectKey>"
	}
}

Question

Why is connectionId versioned? Isn’t that supposed to be a “current user” configuration? Other user might have a different connectionId for the same server, right?

Suggestion

Would it be possible to just version the “projectKey” and then let “SonarQube for IDE” use the only server configured by default (or the current connected one)?
- In case a user has multiple servers configured, it can let the user choose the desired one, and store the selection in the user (or workspace)'s settings.json instead of the project’s settings.json.
- Alternatively, it can still work as is (letting the user to version both at project’s level)

PS: there is a typo in that link. There is a word “TLastly”

image

Hi @gian1200,

Sorry for the late answer. The typo has been fixed in the docs, good catch!

For context, there is no strong recommendation to put the .vscode/settings.json file under version control. The VSCode docs say it can be version-controlled, not that it should be:

This makes it easy to share settings with others in a version-controlled (for example, Git) project.

So far, we recommended users not to put this file under version control, because indeed the connection ID is linked to a user setting.

That said, we could probably improve this approach. I created Jira to consider different options, but given current priorities it’s unlikely we will work on that in the near-future. My recommendation for now is to not version this file.

Hope this helps