skip to Main Content

I want an indented newline after typing opening bracket and pressing Enter in VSCode.

Here’s an example where | is the cursor:

Current behaviour-

function f() {
|}

Behaviour wanted-

function f() {
  |
}

The behaviour I want is the default one, but I don’t know what happened and it doesn’t work like that now. I couldn’t find a solution to it, so I’m asking here. Thanks in advance

2

Answers


  1. Chosen as BEST ANSWER

    Finally, I found the issue. In settings.json somehow I had this included.

    "editor.language.brackets": [
        
    ]
    

    But by default it's not there, or rather this is the default setting:

    "editor.language.brackets": [
        ["[", "]"],
        ["(", ")"],
        ["{", "}"]
    ]
    

    TLDR: Just remove it.


  2. Just press enter, if that didn’t work try to set settings into default or check if it is a part of an abbreviation

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search