How can I configure formatting options in Eclipse for Java Script source code so that having this code:
var o = {
    items: [{
        xtype: 'grid',
        columns: [<cursor here>{header: 'Column One'}],
    }],
};
after pressing Enter I get this
var o = {
    items: [{
        xtype: 'grid',
        columns: [
            {header: 'Column One'}],
    }],
};
instead of the default:
var o = {
    items: [{
        xtype: 'grid',
        columns: [
                  {header: 'Column One'}],
    }],
};
I'd like to have initializers of array's elements indented with one level of indentation (tab in my case) not aligned with the opening bracket. I can't get the right indentation even manually - given this code
var o = {
    items: [{
        xtype: 'grid',
        columns: [
{header: 'Column One'}], // cursor at the beginning of this line
    }],
};
after pressing Tab twice I get the same indentation as after pressing Enter above.
I'm using JavaScript Development Tools ver. 1.3.0.v201103031824 from Eclipse Web Tools Platform.
Eclipse has a default Java code formatting profile, known as Eclipse [built-in], which it uses to format code every time you press the combination keys Ctrl + Shift + F (on Windows) and ⌘ + ⇧ + F (on Mac).
Hope this helps albeit a bit late...
You can change the Formatter for JavaScript in Eclipse->Preferences 
Goto JavaScript->Code Style->Formatter
Edit to create your custom profile and make changes to the following:
In the Line Wrapping Tab
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With