Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vscode] onEnterRules in languages.configuration are ignored #11202

Closed
planger opened this issue May 25, 2022 · 2 comments · Fixed by #11225
Closed

[vscode] onEnterRules in languages.configuration are ignored #11202

planger opened this issue May 25, 2022 · 2 comments · Fixed by #11225
Labels
languages issue related to languages vscode issues related to VSCode compatibility

Comments

@planger
Copy link
Contributor

planger commented May 25, 2022

Bug Description:

It looks like onEnterRules in language configurations of VS Code extensions are ignored in Theia.

As the Theia examples include the vscode.python extension, we can use it for testing.

vscode.python defines that hitting enter after e.g. if TRUE: the next line should indent once:

  "onEnterRules": [
    {
      "beforeText": "^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$",
      "action": {
        "indent": "indent"
      }
    }
  ]

Steps to Reproduce:

  1. Start for instance the browser-app by running yarn browser start
  2. Create a file that ends with .py, such as test.py
  3. Type if TRUE: and then hit enter.

In VS Code this is handled correctly:
Peek 2022-05-25 20-45

In Theia, however, this is ignored:
Peek 2022-05-25 20-46

Additional Information

  • Operating System: Ubuntu Linux
  • Theia Version: Reproduced with master and Theia 1.19
@planger
Copy link
Contributor Author

planger commented May 25, 2022

On a first glance, it seems to work if (but only if) the language configuration is set programmatically by the extension. That works fine, e.g., for built-in javascript, html, etc.

But it doesn't work if it is set declaratively, e.g. for vscode.python or another extension where I manually added a rule to onEnterRules in order to test previousLineText declaratively via the package.json. For those, the languages.configuration object that comes in at PluginContributionHandler#handleContributions does not contain the onEnterRules.

@vince-fugnitto vince-fugnitto added vscode issues related to VSCode compatibility languages issue related to languages labels May 30, 2022
@planger
Copy link
Contributor Author

planger commented May 30, 2022

Just to avoid duplicate work: I'll look into this issue in more detail in the next days.

planger added a commit to eclipsesource/theia that referenced this issue May 31, 2022
Fixes eclipse-theia#11202

Contributed on behalf of STMicroelectronics

Change-Id: I8ad0ba28204f959d43de2f49e2d5467f40093316
Signed-off-by: Philip Langer <planger@eclipsesource.com>
martin-fleck-at pushed a commit that referenced this issue Jun 7, 2022
Fixes #11202

Contributed on behalf of STMicroelectronics

Change-Id: I8ad0ba28204f959d43de2f49e2d5467f40093316
Signed-off-by: Philip Langer <planger@eclipsesource.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
languages issue related to languages vscode issues related to VSCode compatibility
Projects
None yet
2 participants