-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Add support for parenthesis in "when" conditions #91473
Comments
vscode-vim extension overrides the `type` command so that it prevents some keypresses to reach the text document editor. It conflicts with our `onEnter` keybinding that is used to support automatic doc comments extending and indentation insertion. The VSCode-native way to implement this would be to use regular expressions, but as per matklad it is considered not acceptable for the language server. Thus we implement it via a `Enter` keybinding that invokes our `onEnter` command which sends a request to rust-analyzer process and applies the appropriate source change recieved from it. At the end of the day we may only apply ad hoc workarounds for conflicting extensions. But vscode has another bug for that. You either cannot use parantheses in `when` condition of a keybinding or it just malfunctions. See an issue about that here: microsoft/vscode#91473 To get the ultimate context, follow this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing
3308: vscode: fix vscode-vim keybindings conflict r=matklad a=Veetaha Closes #3013 I hope vscode-vim extension overrides the `type` command so that it prevents some keypresses to reach the text document editor. It conflicts with our `onEnter` keybinding that is used to support automatic doc comments extending and indentation insertion. The VSCode-native way to implement this would be to use regular expressions, but as per matklad it is considered not acceptable for the language server. Thus we implement it via a `Enter` keybinding that invokes our `onEnter` command which does it via the language-server. At the end of the day we may only apply ad hoc workarounds for conflicting extensions. But vscode has another bug for that. You either cannot use parantheses in `when` condition of a keybinding or it just malfunctions. See an issue about that here: microsoft/vscode#91473 To get the ultimate context, follow this [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing) Co-authored-by: Veetaha <gerzoh1@gmail.com>
It should be able to properly handle something like |
Keybindings editor is rendering the text generated by when context serialize method. |
Parenthesis are not supported |
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
The workaround is to use boolean algebra and express the same without paranthesis. |
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
Hi, I have questions regarding this issue:
|
at the very least the Keyboard Shortcuts UI should reject inputs that contain parentheses (if they're not supported currently) instead of garbling the user input resulting in non-functioning expressions and no undo. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Related Stack Overflow question: Is there a NOT operator in VSCode Keybindings JSON to invert an entire "when" clause? Please also remember to update the docs if/when this is implemented: |
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. |
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:produces the following invalid when expression:

Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: