ignatov/intellij-erlang

Problems with record autoformatting

istocniks opened this issue · 12 comments

IDEA 14.1.1, Erlang 0.5.11

Let's assume I have an empty record and my cared is placed inside it's braces:
screen shot 2015-04-08 at 2 32 05 pm
That's what happen if I hit enter, an extra closing brace is created:
screen shot 2015-04-08 at 2 32 22 pm

Similar thing happens if the record is not empty:
screen shot 2015-04-08 at 2 37 21 pm
screen shot 2015-04-08 at 2 37 30 pm

My code style config:
screen shot 2015-04-08 at 2 40 45 pm

Just so as you know - the buggy behavior was caused by an unmatched left curly brace in code above.

Not really sure which unmatched left curly brace you are referring to...
I checked the latest build, an extra brace doesn't get created any more, thanks!
But caret still doesn't get indented automatically, looks like you didn't address this bug :(

Please, share an example of incorrect caret indentation - I may have missed some cases.

Thanks for the fast response!
screen shot 2015-04-13 at 11 04 56 am
screen shot 2015-04-13 at 11 05 03 am
Here it is, the caret should be automatically indented here, but it's not.

Where does it go instead? What's your tab/indent/continuation indent size?

And also, why would you want it to go there? The formatter will add indentation for each record field assignment anyway.

Take a look at the screenshots, it goes to the same level as the record definition itself.
Here are my settings:
screen shot 2015-04-13 at 11 15 48 am

Oh, I misread the "caret should be automatically indented here" as if the screenshot would show the correct indentation =)

Thanks!

Thanks again for addressing this, unfortunately I found new bugs after the latest changes :(

  • Closing curly brace doesn't appear/disappear automatically when I add/remove opening curly brace if a record is in function body, but it works if a record is part of function argument list. Same for parentheses and brackets.

screen shot 2015-04-16 at 1 19 55 pm
screen shot 2015-04-16 at 1 20 02 pm
screen shot 2015-04-16 at 1 20 19 pm
screen shot 2015-04-16 at 1 20 25 pm

  • Continuation indent doesn't work and it's config value has no effect, again same for parentheses and brackets.

screen shot 2015-04-16 at 1 17 02 pm
screen shot 2015-04-16 at 1 17 10 pm

  • Caret does not indent when I hit enter inside empty brackets

screen shot 2015-04-16 at 1 27 37 pm
screen shot 2015-04-16 at 1 27 48 pm

Could you create separate issues for these, please?

Once again, thank you very much for reporting issues. It's really unfortunate to have new bugs appearing after fixing the old ones, but we're increasing test coverage, so it'll eventually get better =)

It's a pity that I have no time / enough knowledge to fix these my myself :) Created #594