JavaScript editor: return key does not insert newline after opening square bracket, inserts spaces [message #984596] |
Wed, 14 November 2012 20:51 |
Ben Johnson Messages: 23 Registered: March 2012 |
Junior Member |
|
|
All I want to do is type
and then hit the Enter key to insert a blank line and indent the cursor one tab, yielding the following:
var myArray = [
| <--- pipe position represents cursor (indented one tab)
]
Instead, when I hit the Enter key, Eclipse moves the cursor to the right of the closing square bracket. (I realize that I can disable this aspect under Preferences -> JavaScript -> Editor -> Typing -> Automatically close.) If I then left-arrow back, such that the cursor is between the square brackets, e.g., [|] (the pipe character represents the cursor), and again hit Enter, Eclipse inserts only one newline (when I want two), but it also inserts enough spaces to bring the closing bracket inline with the opening bracket on the line above, like so:
How is this useful?
Eclipse exhibits exactly the behavior that I want if I use curly-braces instead of square brackets.
So, is there any way to force Eclipse to handle square brackets exactly as it handles curly braces?
I have tried creating a custom JavaScript code template (in Preferences -> JavaScript -> Editor -> Templates), and I even unchecked "Use Formatter" for the template, but Eclipse still applies this questionable formatting to the block.
Thanks for any help here.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02904 seconds