java - Customizing Eclipse Formatting -


i know change preferences formatter , change options there. i'm unable figure out how format way want to, , assistance, if possible, format 'my' way. :)

it set "wrap necessary", , seems closest want. , yet, it's producing results aren't quite want. example of current formatting looks

log.error(     string.format(         "creating json object event array @ line number %d failed",         key.get()), e); 

this better there. re-formatted code. before looked

        log                 .error(                         string                                 .format(                                         "creating json object event array @ line number %d failed",                                         key.get()), e); 

and formatting on code. , yes, tabbing accurately reflected in code. previous dev must of had different settings... looking prompted me write code. doing investigation , checking showed settings (default) produce first snippet. if representative of code, fine. since started writing, i'm justy continuing.

so, onto like. end

log.error(string.format(         "creating json object event array @ line number %d failed",         key.get()), e); 

the string gets broken out because extends on line length , key.get... broken because it's past line length. string (as positioned) on line length why key.get... dropped line.

i'm not familiar enough settings in eclipse deal (found them today google) , randomly changing things hoping find i'm looking isn't appealing of option.

obviously length of components going affect results starting white space.
in 2 examples of how formatting operating log.error(string.format( not longer line length. don't want broken 2 lines. change correct that? (man long post simple of question... hehe)

update: tried // suggested below , got following result

log.error(         string.format(                 //                 "creating json object event array @ line number %d failed",                 key.get()), e); 

not full answer question, but: easy way force eclipse formatter break line pretend insert comment. time time add // before line break, , eclipse won't revert it, while indenting next line expected.

so i'd try this:

log.error(string.format( //         "creating json object event array @ line number %d failed",         key.get()), e); 

maybe // on second line needed too, according preferred line width.


Comments