SonarLint with TypeScript on VS Code: Illegal state - we missed the open notification

Please provide

  • Operating system: Windows 10 64bit
  • IDE name and flavor/env: SonarLint VS Code with TypeScript
  • SonarLint plugin version: v3.5.3
  • Is connected mode used: Yes
    • Connected to SonarCloud or SonarQube (and which version): SonarCloud

And a thorough description of the problem / question:

I am trying to set up SonarLint for VS Code but I cannot get it to analyse any of my TypeScript files. Oddly enough, it works fine when it tries to analyse the workspace configuration file and correctly reports 0 issues in the output log.

Whenever I open a .ts file, these lines in the log consistently appear regardless of the file name:

[Debug - 17:30:51.660] Skipping analysis for preview of file 'file:///c:/Projects/MyProject/my-project-file.ts'
[Warn  - 17:30:57.871] Illegal state. File 'file:///c:/Projects/MyProject/my-project-file.ts' is reported changed but we missed the open notification
[Warn  - 17:30:58.585] Illegal state. File 'file:///c:/Projects/MyProject/my-project-file.ts' is reported changed but we missed the open notification

These lines happen for every single file I attempt to open with the only exception I’ve noticed being the workspace configuration file. Even purposefully breaking a known enabled SonarCloud rule does not report any issues. I should point out that the rules themselves seem to load just fine from SonarCloud and the configuration is correct. It’s just the local analysis which fails.

Any advice on this would be appreciated!

1 Like

+1
I also have exactly same issue on macOs. Using Connected mode
My SonarLint output:

Executing /Library/Java/JavaVirtualMachines/jdk-11.0.15.1.jdk/Contents/Home/bin/java -jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/server/sonarlint-ls.jar 52606 -analyzers /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarjava.jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarjs.jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarphp.jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarpython.jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarhtml.jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarxml.jar /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarcfamily.jar -extraAnalyzers /Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/analyzers/sonarsecrets.jar
[stdout] Binding to 52606
Child process connected on port 52606
Java resolved to: /Library/Java/JavaVirtualMachines/jdk-11.0.15.1.jdk/Contents/Home
[Info  - 20:36:09.925] Started security hotspot handler on port 64120
Initializing file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2 on branch release/3.2
[Debug - 20:36:10.027] Fetching global configuration
[Debug - 20:36:10.033] Folder file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2 is now on branch release/3.2.
[Debug - 20:36:10.043] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/components/Table/index.tsx
[Debug - 20:36:10.059] Fetching configuration for folder 'file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2'
[Debug - 20:36:10.063] Starting connected SonarLint engine for '<default>'...
[Debug - 20:36:10.065] Workspace folder 'WorkspaceFolder[name=mp,uri=file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2]' configuration updated: WorkspaceFolderSettings[analyzerProperties={},connectionId=<default>,pathToCompileCommands=,projectKey=%project_key%,testFilePattern=]
[Debug - 20:36:10.068] Global settings updated: WorkspaceSettings[connections={<default>=ServerConnectionSettings[connectionId=<default>,disableNotifications=false,organizationKey=<null>,serverUrl=%server_url%,token=%token%]},disableTelemetry=false,excludedRules=[],includedRules=[],pathToNodeExecutable=/usr/local/opt/node@16/bin/node,ruleParameters={},showAnalyzerLogs=true,showVerboseLogs=true]
[Debug - 20:36:10.070] Node.js path provided by configuration: /usr/local/opt/node@16/bin/node
[Debug - 20:36:10.070] Checking node version...
[Debug - 20:36:10.076] Execute command '/usr/local/opt/node@16/bin/node -v'...
[Debug - 20:36:10.085] Enabling notifications for project '%project_key%' on connection '<default>'
[Debug - 20:36:10.088] Default settings updated: WorkspaceFolderSettings[analyzerProperties={},connectionId=<default>,pathToCompileCommands=,projectKey=%project_key%,testFilePattern=]
[Debug - 20:36:10.122] Command '/usr/local/opt/node@16/bin/node -v' exited with 0
stdout: v16.13.2
[Debug - 20:36:10.123] Detected node version: 16.13.2
[Warn  - 20:36:10.310] Plugin 'secrets' embeds dependencies. This will be deprecated soon. Plugin should be updated.
[Debug - 20:36:10.405] Loaded 8 plugins
[Debug - 20:36:10.405]   * CFamily Code Quality and Security 6.33.0.46593 (cpp)
[Debug - 20:36:10.405]   * Python Code Quality and Security 3.5.0.8244 (python)
[Debug - 20:36:10.406]   * Java Code Quality and Security 7.1.0.26670 (java)
[Debug - 20:36:10.406]   * HTML Code Quality and Security 3.6.0.3106 (web)
[Debug - 20:36:10.406]   * XML Code Quality and Security 2.2.0.2973 (xml)
[Debug - 20:36:10.406]   * PHP Code Quality and Security 3.17.0.7439 (php)
[Debug - 20:36:10.406]   * Sonar Secrets Plugin for SonarQube 1.1.0.36766 (secrets)
[Debug - 20:36:10.406]   * JavaScript/TypeScript/CSS Code Quality and Security 9.2.0.17876 (javascript)
[Debug - 20:36:12.758] Creating container for module 'file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2'
[Debug - 20:36:12.780] SonarLint engine started for connection '<default>'
[Debug - 20:36:12.806] Connecting to server event-stream at 'api/push/sonarlint_events?projectKeys=%project_key%&languages=apex,c,cpp,web,java,js,php,plsql,py,secrets,ts,xml'...
[stderr] WARNING: An illegal reflective access operation has occurred
[stderr] WARNING: Illegal reflective access by org.apache.hc.core5.util.ReflectionUtils$1 (file:/Users/keenubee/.vscode/extensions/sonarsource.sonarlint-vscode-3.5.3/server/sonarlint-ls.jar) to method sun.security.ssl.SSLEngineImpl.getApplicationProtocol()
[stderr] WARNING: Please consider reporting this to the maintainers of org.apache.hc.core5.util.ReflectionUtils$1
[stderr] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[stderr] WARNING: All illegal access operations will be denied in a future release
[Debug - 20:36:13.823] Server events not supported by the server
[Debug - 20:36:17.408] Resolved binding ProjectBinding[idePathPrefix=,projectKey=%project_key%,sqPathPrefix=] for folder /Users/keenubee/Documents/Проекты/1/2
[Debug - 20:36:19.168] Synchronizing storage
[Debug - 20:36:19.397] GET 200 %server_url%/api/system/status | response time=223ms
[Debug - 20:36:19.398] Downloaded server infos in 209ms
[Debug - 20:36:19.802] GET 200 %server_url%/api/plugins/installed | response time=399ms
[Info  - 20:36:19.809] Downloaded plugin list in 406ms
[Debug - 20:36:19.810] [SYNC] Code analyzer 'csharp' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.811] [SYNC] Code analyzer 'cssfamily' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.811] [SYNC] Code analyzer 'communityBranchPlugin' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.811] [SYNC] Code analyzer 'dependencycheck' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.811] [SYNC] Code analyzer 'flex' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.812] [SYNC] Code analyzer 'go' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.812] [SYNC] Code analyzer 'web' is embedded in SonarLint. Skip downloading it.
[Debug - 20:36:19.812] [SYNC] Code analyzer 'jacoco' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.812] [SYNC] Code analyzer 'java' is up-to-date. Skip downloading it.
[Debug - 20:36:19.812] [SYNC] Code analyzer 'javascript' is embedded in SonarLint. Skip downloading it.
[Debug - 20:36:19.813] [SYNC] Code analyzer 'kotlin' is disabled in SonarLint (language not enabled). Skip downloading it.
[Debug - 20:36:19.813] [SYNC] Code analyzer 'php' is up-to-date. Skip downloading it.
[Debug - 20:36:19.813] [SYNC] Code analyzer 'python' is up-to-date. Skip downloading it.
[Debug - 20:36:19.813] [SYNC] Code analyzer 'ruby' is disabled in SonarLint (language not enabled). Skip downloading it.
[Debug - 20:36:19.813] [SYNC] Code analyzer 'sonarscala' is disabled in SonarLint (language not enabled). Skip downloading it.
[Debug - 20:36:19.814] [SYNC] Code analyzer 'elixir' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.814] [SYNC] Code analyzer 'vbnet' does not support SonarLint. Skip downloading it.
[Debug - 20:36:19.814] [SYNC] Code analyzer 'xml' is up-to-date. Skip downloading it.
[Info  - 20:36:19.815] [SYNC] Synchronizing analyzer configuration for project '%project_key%'
[Debug - 20:36:20.090] GET 200 %server_url%/api/settings/values.protobuf?component=%project_key% | response time=252ms
[Info  - 20:36:20.102] Downloaded settings in 265ms
[Debug - 20:36:20.334] GET 200 %server_url%/api/qualityprofiles/search.protobuf?project=%project_key% | response time=228ms
[Debug - 20:36:20.347] Downloaded project quality profiles in 241ms
[Info  - 20:36:20.350] [SYNC] Active rules for 'java' are up-to-date
[Info  - 20:36:20.350] [SYNC] Active rules for 'js' are up-to-date
[Info  - 20:36:20.351] [SYNC] Active rules for 'php' are up-to-date
[Info  - 20:36:20.351] [SYNC] Active rules for 'py' are up-to-date
[Info  - 20:36:20.351] [SYNC] Active rules for 'ts' are up-to-date
[Info  - 20:36:20.351] [SYNC] Active rules for 'web' are up-to-date
[Info  - 20:36:20.351] [SYNC] Active rules for 'xml' are up-to-date
[Debug - 20:36:20.364] Storing project analyzer configuration in /Users/keenubee/.sonarlint/storage/3c64656661756c743e/projects/696e6368617267696e675f6d705f41586f5065376b377279413270696c6d6e793977/analyzer_config.pb
[Info  - 20:36:20.384] [SYNC] Synchronizing project branches for project '%project_key%'
[Debug - 20:36:20.601] GET 200 %server_url%/api/project_branches/list.protobuf?project=%project_key% | response time=215ms
[Debug - 20:36:20.617] Storing project branches in /Users/keenubee/.sonarlint/storage/3c64656661756c743e/projects/696e6368617267696e675f6d705f41586f5065376b377279413270696c6d6e793977/project_branches.pb
Folder file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2 is now on branch release/3.2
[Debug - 20:36:31.310] Folder file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2 is now on branch release/3.2.
Folder file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2 is now on branch release/3.2
[Debug - 20:36:36.450] Folder file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2 is now on branch release/3.2.
...
[Debug - 21:01:00.543] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/SomeComponent/index.tsx
[Warn  - 21:01:29.282] Illegal state. File 'file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/SomeComponent/index.tsx' is reported changed but we missed the open notification
1 Like

Hello, welcome to both of you! And thank you for the detailed reports.

In both cases, I notice the following log message:

Skipping analysis for preview of file xxx

This is related to a check that was introduced in the latest version to avoid triggering analysis of the IDE’s “preview” boxes. This works by asking the IDE whether a true editor tab is open for the given file, and it seems that this check fails for some reason on your machines.

Unfortunately, I did not manage to reproduce this issue on my development boxes (Windows 11 and Ubuntu).

  • Could you please confirm that it happens to all (or most) files you try to open?

  • If I build a VSIX file with some troubleshooting code, would you be able to install it manually in VSCode?

Thanks!

Hi, seems like it happens for any file:

[Debug - 23:05:23.758] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/routes/Component/routes/ComponentListList/index.tsx
[Debug - 23:05:29.664] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/routes/Component/routes/ComponentList/Filters/index.module.scss
[Debug - 23:05:30.333] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/routes/Component/routes/ComponentList/Filters/index.tsx
[Debug - 23:05:34.691] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/routes/Component/routes/ComponentList/Filters/index.module.scss
[Debug - 23:05:46.338] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/service-worker.ts
[Debug - 23:05:50.102] Skipping analysis for preview of file file:///Users/keenubee/Documents/%D0%9F%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D1%8B/1/2/src/setupProxy.js

And yes, i am able to test VSIX locally.

Thank you for the additional details.

I managed to reproduce the issue by trying to open a folder named # {}test in VSCode, it seems that the “preview check’s” code has some issues with URI encoding (URIs are hard).

I will post a bit later once I have a VSIX with a potential fix.

Also FYI I created a ticket to track this issue.

1 Like

Hello, thanks all for your patience.

A snapshot build with a fix should be available here, @keenubee @angel.peltekov could you please check that it fixes the issue you face?

If this is the case, we will release it tomorrow to the marketplace.

Thanks!

1 Like

Thank you, Jean-Baptiste, snapshot build works fine for me :+1:

1 Like

Thank you for the confirmation!

For your information, version 3.5.4 just got published to the VSCode marketplace.