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

[cc] switch should indent +2 for cases, not +4 #114

Open
mtaran-google opened this issue Feb 7, 2018 · 3 comments
Open

[cc] switch should indent +2 for cases, not +4 #114

mtaran-google opened this issue Feb 7, 2018 · 3 comments

Comments

@mtaran-google
Copy link
Contributor

int main() {
  int i = 0;
  switch (i) {
  }
}

when pressing enter after the line with switch on it, the indent should be +2

@marijnh
Copy link
Member

marijnh commented Feb 7, 2018

Your indentation tests require regular statements inside of switch to be indented 4 spaces, and labels 2 spaces.

@mtaran-google
Copy link
Contributor Author

I see... right now it will unindent two spaces after the : is typed. That ends up working, but it'd be better if the indent was +2 from the beginning. It does appear that it's technically possible to put other statements before the initial label, but that is not actually useful for anything, so the statements between labels will always be +4 and the labels will be +2.

@marijnh
Copy link
Member

marijnh commented Feb 8, 2018

It's hard to know, in the indentation code, whether we are at the start of the block or after some label, and as you noticed, it'll correct itself anyway when you type a label, so I'd argue this isn't a huge problem and doesn't warrant extra kludges. Was also not part of the initial requirements.

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