question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for parenthesis in "when" conditions

See original GitHub issue
  • 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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:66
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Spongmancommented, Jul 13, 2022

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.

3reactions
a-stewartcommented, Mar 31, 2022

I’ve created a draft cl / POC for how parentheses could be handled in a way that is unlikely to cause issue with existing parentheses in values and regex logic.

Still needs work, in particular regarding any conflicts with existing when clauses using brackets in regex, but it might be useful to open a discussion

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add parenthesis support for if: conditions - GitLab.org
Allow to create a complex expressions and conditions with () in expressions: supports only:variables: supports rules:if: Example:.
Read more >
When should you use parentheses inside an if statement's ...
You should generally use the parenthesis when you have to, and that would be when issues with operator presedence occur. – adeneo. Mar...
Read more >
SQL: Using Parentheses with And / OR condition is necessary ...
My answer was YES, I use parenthesis to bind components of where clauses, i.e., If the query has multiple and or condition, ...
Read more >
Should I fully parenthesize expressions or rely on precedence ...
Good developers strive to write code that is clear and correct. Parentheses in conditionals, even if they are not strictly required, help with...
Read more >
AND and OR operators and parenthesis in queries
Use parentheses to group the OR statements in queries ... If you have an AND statement and a number of logically related OR...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found