Skip to content

Add support for parenthesis in "when" conditions #91473

Closed

Description

  • VSCode Version: 1.42.0
  • OS Version: Ubuntu 18.04.3

The when expression that contains parentheses which we set for a keybinding defined in the contribution point of our extension results into a corrupted (invalidly transformed expression in user's keybinding settings), e.g. the following declaration:

{
    "command": "extension.helloWorld",
    "key": "enter",
    "when": "editorLangId == rust && !suggestWidgetVisible && (!vim.active || vim.mode == 'Insert')"
}

produces the following invalid when expression:

Steps to Reproduce:

  1. Go to the following repo with the reproduction
  2. Follow the steps in README.md

Does this issue occur when all extensions are disabled?: Yes

Activity

  1. added
    bug
    keybindings-editor
    on Feb 26, 2020
  2. added a commit that references this issue on Feb 27, 2020
  3. yasintz commented on Mar 4, 2020

    @yasintz

    It should be able to properly handle something like
    ( (a&&(b|| c) && d) ) && !e && false && true || !(f != g) && (h == i).

  4. sandy081 commented on Apr 2, 2020

    @sandy081
    Member

    Keybindings editor is rendering the text generated by when context serialize method.

  5. 29 remaining items

  6. added
    unreleased
    on Feb 20, 2023
  7. removed
    unreleased
    on Feb 20, 2023
  8. ulugbekna commented on Mar 8, 2023

    @ulugbekna
    Contributor

    Hi everyone! 👋🙂

    Support for parentheses in "when" clauses is now available in VS Code Insiders and is planned to be available in the March release of VS Code early next month.

    We rewrote the parser to make it more flexible, correct, and easier to change. You can read more about upcoming changes: new features, breakages, migration help in this issue. You can subscribe to that issue to get more updates and/or leave us feedback there.

    We also encourage you to test your extensions with VS Code Insiders to make sure things work as you expect, and use the new linter mentioned in the issue above to see if some of the when-clauses you have contain errors.

  9. locked and limited conversation to collaborators on Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

context-keysfeature-requeston-testplan

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions