]
Ilya Buziuk updated ERT-339:
----------------------------
Story Points: 10
Array initializer auto-formatting is a hideous, broken nightmare
[EBZ#419931]
-----------------------------------------------------------------------------
Key: ERT-339
URL:
https://issues.jboss.org/browse/ERT-339
Project: Eclipse Release Train
Issue Type: Task
Components: JSDT
Reporter: Friendly Jira Robot
Labels: General, bzira
Fix For: Neon.1 (4.6)
If you are writing an array initializer in JavaScript, you most likely want to it to look
like this:
var myArray = [
item1,
item2,
item3,
...
];
However, no matter how you configure Eclipse to format array initializers, it ignores it
all and instead tries to make you kill yourself with frustration.
Actually *typing* an array initializer goes like this, cursor position indicated by _
1. You type the following:
var myArray = [_
2. Eclipse inserts a closing paren:
var myArray = [_]
3. You press enter, expecting to a get a newline, but instead Eclipse interprets it as
"move the cursor to the end of the line:
var myArray = []_
4. You left-arrow the cursor back a position, and press enter again. This time, Eclipse
does insert a newline. But it auto-indents as follows:
var myArray = [
_]
Rather than following the same, sane behaviour it provides for object initializers,
Eclipse idents the following line to the same column as the opening paren, it idents using
spaces, even if you've configured it to use tabs and only tabs for indentation, and it
leaves the closing paren on the same line, rather than moving it to the start of the
next.
Trying to fix the indentation is impossible, because it has used spaces instead of tabs.
If you delete the spaces and press tab, it merely re-inserts the spaces and re-indents
back to the column of the open paren!
It's hard to adequately emphasise what a frustrating, poisonous impression this makes
on someone using Eclipse as a tool for JavaScript development. It feels actively
user-hostile.