Missing indentation after a control statement without brackets #476
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
If you type a control statement without opening brackets and hit enter, the indentation level is maintained rather than being increased one level:
I suspect this could be desirable if one was using brackets "BSD" style:
if (2>1)
{
code;
}
Which I think could be handled by detecting the open bracket at the beggining of the line and immediately decreasing indentation. I don't know if the core supports this type of behavior, I'm not aware of the specifics of how auto indentation works. Otherwise, this could also be a setting for your preferred indentation style.
Steps to Reproduce
- Type `if (2>1)``
- Press enter
Expected behavior: Second line indentation level should be increased.
Actual behavior: Second line indentation level is the same.
Reproduces how often: 100%
Versions
Atom : 1.12.7
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
apm 1.12.9
npm 3.10.5
node 4.4.5
python
git
visual studio 2013
Windows 8.1
Additional Information
Furthermore, there's a related issue with the indentation of closing brackets involving a similar situation:
This appears to be because the closing bracket always decreases indentation by one level. The correct behavior should be to return to the indentation level of the opening bracket, regardless of the current indentation. Again I'm not sure if this is a language-javascript level issue, or a more general core issue.