Coisox
Coisox

Reputation: 1104

Jump To Parent's Bracket in Visual Studio Code

This is Visual Studio Code question regarding shortcut. I know I can jump between match tag using CTRL+SHIFT+{

But how to jump from bracket (from here) to bracket (to here)? I mean go to closest parent's bracket. Possible?

a: { //to here
    b: {
    
    },
    c: function() { //not here
    
    }, //from here
}

Alternatively if not possible, any shortcut to close all siblings bracket? So that I can quickly know the parent? Or get the parent's info (eg function name or line number)

Upvotes: 2

Views: 4370

Answers (2)

schogges
schogges

Reputation: 459

As per default this shortcut is not set, but it's possible to set:

  1. Ctrl+Shift+P (Mac: Cmd+Shift+P)
  2. Search and go to Preferences: Open Keyboard Shortcuts
  3. Search and set Go to Parent Fold. In the When column, I set editorFocus.

Alternatively you can edit the keybindings.json, e.g. via Preferences: Open Keyboard Shortcuts (JSON) and add

{
    "key": "<your_keybinding>",
    "command": "editor.gotoParentFold",
    "when": "editorFocus"
}

Upvotes: 0

Coisox
Coisox

Reputation: 1104

I post same question at many places. So 1 of them came back with solution.

Open the Command Palette (Ctrl+Shift+P), select "Go To Parent Fold".

Upvotes: 15

Related Questions