-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Brackets doesn't recognize existing indentation when auto-indenting close braces #8395
Comments
Added "...when auto-indenting close braces" to title to clarify when this happens |
Note that same problem happens with any auto closing, so "brace" is used generically here. |
Yep -- or at least, "electric chars" that can change indent. I think that's only curly braces, square braces, and parens. |
what do you think the proper behavior should be if that 2nd line indent also has text to the right? for instance: if (foo) {
// this is a comment so then I enter a if (foo) {
} // this is a comment I suppose what we want to do is indent and remove whitespace to the right of the closing electric? |
@mackenza I don't think any whitespace should be removed in that case. Since there are non-whitespace chars on line, then it's all visible, so there are no surprises. |
Fix in Progress. Assigning to me while @mackenza works on it. |
Confirmed. Closing. |
Start with 2 indented lines where there's an unmatched opening brace on first line and no code on second line:
Move cursor to beginning of second line (before indentation, not after) and type closing brace
}
.Results:
Brackets adds indentation and then adds the brace. Original indentation is left after the closing brace!
Expected:
Resulting code should not have trailing whitespace.
The text was updated successfully, but these errors were encountered: