Skip to content
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

Bug: autoClosing Braces and Parentheses have incorrect indent #76

Closed
tuckergordon opened this issue Feb 1, 2022 · 1 comment
Closed

Comments

@tuckergordon
Copy link

It looks like the behavior of the auto closing braces and parentheses does not match that of the brackets.

Consider the following options:

let options = {
  indentOn: /[{\\([]$/,  // indent on {, (, and [
  addClosing: true
}

If I have this code in my editor

{
  "a": 1,
  "b": {}
}

then place my cursor inside the {} and press return, it results in this:

{
  "a": 1,
  "b": {
  	
  }
}

which is expected. However, following a similar procedure with braces or parentheses results in this:

{
  "a": 1,
  "b": [
  	]
}

I would expect that, because braces and parentheses are included in the behaivor of addClosing, that they would indent in the same way as braces:

{
  "a": 1,
  "b": [
  	
  ]
}
@tuckergordon tuckergordon changed the title autoClosing Braces and Parentheses have incorrect indent Bug: autoClosing Braces and Parentheses have incorrect indent Feb 1, 2022
Repository owner deleted a comment from TomFevrier Apr 3, 2022
@antonmedv
Copy link
Owner

Fixed! Now there is a separate regexp to test which lines to move on:

    indentOn: /[({\[]$/,
    moveToNewLine: /^[)}\]]/,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants