Issue using SonarLinte with Visual Studio Code on a remote server via ssh fs

Hello Sonar Team,

I’m actually facing an issue to configure well SonarLint on my VSC on a SSH remote workspace.
Find here my informations

  • Operating system: Windows 10 Enterprise 21H2
  • SonarLint plugin version: v3.11.0
  • Programming language you’re coding in: Javascript
  • Not connected to SonarQube or SonarCloud
  • SSH Extension: SSH FS v1.25.0 (From Kelvin Schoofs)
  • Remote server OS: Centos 7.9

I configured SonarLint as following:

User settings.json:

...
...
"sonarlint.analyzerProperties": {
    
    
    },
	"sonarlint.output.showVerboseLogs":true,
    "sonarlint.output.showAnalyzerLogs":true,

Workspace : workspace.json:

{
	"folders": [
		{
			"name": "SSH FS - ...",
			"uri": "ssh://..."
		}
	],
	"settings": {
		"sonarlint.analyzerProperties": {
		
		},
		"sonarlint.output.showVerboseLogs":true,
		"sonarlint.output.showAnalyzerLogs":true,
	}
}

SSH FS - … settings.json:

{
    "sonarlint.analyzerProperties": {
    

    },
    "sonarlint.connectedMode.project": {
    
    },
    "sonarlint.output.showVerboseLogs":true,
    "sonarlint.output.showAnalyzerLogs":true,
}

On local files, SonarLint works well. But nothing happen on remote files.
Here is the log from SonarLint output:

Executing c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\jre\17.0.4.1-win32-x86_64.tar\bin\java -jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\server\sonarlint-ls.jar 53927 -analyzers c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarjava.jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarjs.jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarphp.jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarpython.jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarhtml.jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarxml.jar c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarcfamily.jar -extraAnalyzers c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\analyzers\sonarsecrets.jar
[stdout] Binding to 53927
Child process connected on port 53927
Java resolved to: c:\Users\****\.vscode\extensions\sonarsource.sonarlint-vscode-3.11.0-win32-x64\jre\17.0.4.1-win32-x86_64.tar
[stderr] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stderr] SLF4J: Defaulting to no-operation (NOP) logger implementation
[stderr] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Info  - 08:36:41.600] Started request handler on port 64120
Initializing ssh://**** on branch undefined
[Debug - 08:36:41.683] Fetching global configuration
[Debug - 08:36:41.686] Folder ssh://**** is now on an unknown branch.
[Debug - 08:36:41.707] Fetching configuration for folder 'ssh://****'
[Debug - 08:36:41.716] Workspace folder 'WorkspaceFolder[name=SSH FS - vps-cbak-site-web,uri=ssh://****]' configuration updated: WorkspaceFolderSettings[analyzerProperties={},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Debug - 08:36:41.718] Global settings updated: WorkspaceSettings[connections={},disableTelemetry=false,excludedRules=[],includedRules=[],pathToNodeExecutable=,ruleParameters={},showAnalyzerLogs=true,showVerboseLogs=true]
[Debug - 08:36:41.740] Default settings updated: WorkspaceFolderSettings[analyzerProperties={},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]

There is a .vscode directory at the root directory project with 775 permissions. This directory is containing a settings.json file with the following configuration:

{
    "sonarlint.analyzerProperties": {

    },
    "sonarlint.connectedMode.project": {

    },
    "sonarlint.output.showVerboseLogs":true,
    "sonarlint.output.showAnalyzerLogs":true,
}

There is no JRE on this server. Tell me if it is needed.

Thanks a lot for your help

Hello, welcome to the community! And thank you for the details about your setup, it helps a lot with the investigation.

I installed the SSH FS extension and as far as I can tell, the IDE does not send any request to the SonarLint Language Server (or any language server) for files in workspace folders created by the extension. The extension’s README mentions that it should work with other extensions that rely on the vscode.workspace.fs API, but it seems that it bypasses the IDE’s built-in LSP support.

If it is compatible with your environment, I would advise to use the Remote SSH extension (part of the Remote Development Pack) instead. Please note that with this extension, the VSCode server (and any language server contributed by extensions) will run on the SSH remote host.