Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Missing indentation after a control statement without brackets #476

Open
1 task done
madakk opened this issue Dec 26, 2016 · 2 comments
Open
1 task done

Missing indentation after a control statement without brackets #476

madakk opened this issue Dec 26, 2016 · 2 comments

Comments

@madakk
Copy link

madakk commented Dec 26, 2016

Prerequisites

Description

If you type a control statement without opening brackets and hit enter, the indentation level is maintained rather than being increased one level:

js_indent

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

  1. Type `if (2>1)``
  2. 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:

js_indent2

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.

@madakk madakk changed the title Missing identation after a control statement without brackets Missing indentation after a control statement without brackets Dec 26, 2016
@winstliu
Copy link
Contributor

Your second bug in the additional information section is a more general core issue.

@patrickjane
Copy link

Any news on this bug?

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

No branches or pull requests

3 participants