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.

Delete matching parentheses, brackets, or braces

See original GitHub issue
  • VSCode Version: Code 1.16.1 (27492b6bf3acb0775d82d2f87b25a93490673c6d, 2017-09-14T16:38:23.027Z)
  • OS Version: Windows_NT x64 6.3.9600
  • Extensions: Extensions are disabled

Steps to Reproduce:

  1. Create a new file.
  2. Paste the following code: var foo = (1 + bar) + baz;.
  3. Position the cursor before the first (. It and its matching parenthesis should highlight.
  4. Hit the delete key.
  5. Only the first parenthesis is deleted.

It would be useful if the corresponding parenthesis, brace, or bracket were deleted when the targeted one was.

I see two ways to accomplish this:

  1. Add a shortcut for both backspace and delete that does the operation on the matching character.
  2. Automatically do the deletion. This could be an extension of the already-existing “editor.autoClosingBrackets” setting or (more likely) a new setting that governs this behavior.

Reproduces without extensions: Yes

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:76
  • Comments:9

github_iconTop GitHub Comments

10reactions
jkyeungcommented, Sep 22, 2017

This feature could be useful, but it could also be confusing and annoying, especially when editing code which already starts out with mismatched brackets. So it should absolutely be optional and off by default, or initially mapped to something other than plain Delete or Backspace.

Further, whether this new feature is active should be independent of whether editor.autoClosingBrackets is active.

9reactions
wendecommented, Aug 21, 2018

@jkyeung Or it could be done like Atom Editor does it. Bksp for regular bahaviour C-Bksp for matching parens behaviour

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to quickly remove a pair of parentheses, brackets, or ...
I would do xf] , but it doesn't do paren-matching. Or, first do a manual paren-matching by % , then x followed by...
Read more >
delete matching parentheses : r/vim - Reddit
i`m talking about parentheses, brackets, braces etc. when i type in vim something like <( )>, and then i want to erase them, ......
Read more >
How to delete surrounding brackets? - Emacs Stack Exchange
Use up-list or backward-up-list to move forward or backward to the first enclosing bracket, then forward-list or backward-list to locate the ...
Read more >
Auto-delete closing brackets after deleting opening brackets.
Currently we can select all between matching braces (Ctrl+Alt+B) and I think it wouldn't be too much of a leap to think that...
Read more >
AHK Studio: Adding, Deleting Matching Braces, Brackets ...
In this review of AHK Studio I demonstrate how to easily Add, delete, manipualate matching braces in AHK StudioSee more tutorials on AHK ......
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