antonmedv/codejar

Bug: autoClosing Braces and Parentheses have incorrect indent

tuckergordon opened this issue · 1 comments

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": [
  	
  ]
}

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

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