eclipse-theia/theia

Problem updating configuration through a VSCode plugin

Open

#6,517 创建于 2019年11月8日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)TypeScript (18,676 star) (2,478 fork)batch import
bughelp wantedpreferencesvscode

描述

Actually I just started with eclipse/che:7.3.1 and the Theia editor. I wanted to create a pull request in eclipse/che-plugin-registry and update the VScode plugin "sonarlint-vscode" (https://github.com/SonarSource/sonarlint-vscode/) from version 1.6.0 to 1.11.0, but discovered a problem with the new version in Theia IDE. The new version includes a new feature to configure rules. The plugin works and this new feature also works correctly when I edit the user preferences manually. For example:

{
  "sonarlint.rules": {
    "php:S121": {
      "level": "off"
    }
  }
}

This new version also provides a new tab "Sonarlint Rules" in the Explorer panel where you can see all rules and toggle each one on or off. This view also shows the settings from the user preferences correctly. Unfortunately when you toggle one rule in this view it will delete the whole sonarlint.rules object in the user preferences. Other settings are not removed from user preferences. Also in the editor you can deactivate a single rule when you click on a yellow bulp and open the in place menu. This also removes the complete sonarlite.rules configuration.

I could reproduce this same behavior also in https://gitpod.io/#https://github.com/eclipse-theia/theia when drag&drop the vscode plugin https://github.com/SonarSource/sonarlint-vscode/releases/download/1.11.0/sonarlint-vscode-1.11.0.vsix into the editor.

In VScode this plugin does work correctly and just updates the sonarlint.rules object when toggling one rule in the Explorer panel.

When I look into the sonarlint-vscode toggleRule function (https://github.com/SonarSource/sonarlint-vscode/blob/master/src/extension.ts#L172) it executes an VSCode.WorkspaceConfiguration.update() and the target is VSCode.ConfigurationTarget.Global. These APIs should be available in Theia according to the compatibility matrix I found at https://che-incubator.github.io/vscode-theia-comparator/status.html

So the rules configuration gets correctly read from preferences because they are displayed in the sonarlint rules explorer panel and the extension behaves according to the rules in the editor. The vscode plugin APIs to write the toggled configuration back to the preferences should be supported by Theia. This plugin does work correctly when used in VSCode. Unfortunately I am not sure how to further investigate this problem. Could there be a problem in Theia's vscode plugin implementation or do you have any other ideas?

贡献者指南