Connected mode seemingly doesn't work 🤔

Please provide

  • Operating system: WSL2 (Ubuntu) on Windows 11
  • SonarLint plugin version: v3.17.0
  • Programming language you’re coding in: TypeScript
    • NodeJS version: v16.16.0
  • Is connected mode used: Attempting (this is the problem area)
    • Connected to SonarCloud or SonarQube (and which version): SonarCloud

I’m trying to get connected mode setup, but it just doesn’t seem to be working.

I may have a slightly odd project setup which could be a contributing factor so I guess it’s worth mentioning that it’s a mono-repo with several projects, 2 of which SonarCloud is used on and both projects have a sonar-project.properties file. In VS Code I have the root folder of the mono-repo open as a workspace and each project within as a workspace as well.

The problem I’m finding is with adding a new SonarCloud connection, I add my user token and enter the Org key, this seems to autofill the connection name with the Org key as well, so I leave that as it is. After clicking the “Save connection” button I just get a never-ending “Checking connection…” with a spinner. I have both “Show verbose logs” and “Show analyzer logs” enabled in the extension settings, but I still see no errors show up in the log output. Even after waiting for 2 minutes, without touching anything else and the only new log line that appears after clicking the connect button is:

[Debug - 15:36:13.520] Skipping analysis for preview of file file:///home/myuser/.vscode-server/data/Machine/settings.json

I did, however, manage to once get it to ask to bind the project folders, I achieved this by spamming the connect button a little :sweat_smile: But even after setting them for the 2 projects/workspaces that do use SonarCloud, all I had was a settings file created in those folders with the project key inside, but still no connection shows in the Connected mode list. Also, the errors that show for the projects on the SonarCloud site are not showing up in VS Code even simple things like code smells.

I’m not sure what’s going wrong here, but I really would like to get this working :slightly_smiling_face:

Hello Chris, welcome to the Sonar community! :wave:

Thanks for raising this topic. Unfortunately, I was not able to reproduce these issues so far. Is your internet connection stable and have you generated the correct User Token in the SonarCloud UI (the Generate Token button from the connection setup view should redirect you there)? Could you share the contents of your VSCode user settings for the following properties:

  • sonarlint.connectedMode.sonarqube
  • sonarlint.connectedMode.sonarcloud

Also, workspace settings content (.vscode/settings.json) for sonarlint.connectedMode.project for both folders?

Best,
Sophio from :sonarlint:

1 Like

Heya Sophio, thanks for getting back to me :slightly_smiling_face:

While typing up my reply, I found the issue. :smiling_face_with_tear:

A while ago I moved sonarlint.connectedMode.connections.sonarcloud from my user settings to the workspace settings since I sometimes work in other repos, while looking for the settings you were asking for, VS Code helpfully informed me that this is an application-wide setting and thus can not be set in any other setting file. Removing this and attempting to re-add the connection works as expected!

Thanks for leading me to find the issue! :slightly_smiling_face:

2 Likes

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