Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set the formatter in Eclipse?

 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Normally one can format the source code in Eclipse with ctrl-shift-f. But the default length of a line is set to 70 charaters. How can I change this to let it be 100 charaters?

 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on the file type. For Java source files, the setting is at Window > Preferences > Java > Code Style > Formatter, click Edit, then select the Line Wrapping tab.

For other file types it is in other locations. For example, for HTML is is at Window > Preferences > Web > HTML Files > Editor.
 
Tim Holloway
Saloon Keeper
Posts: 18366
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I set my lines DOWN to 65 characters. Years ago when I was doing Macintosh development, some of my co-workers had large monitors. I couldn't read their code properly, because it ran outside the viewing window on my smaller monitor.

I've got a nice wide monitor myself these days, but one thing hasn't changed: I still print on standard-sized paper. Wide lines either get truncated (losing data) or wrapped (ruining the nice pretty formatting). So even though I have sufficient screen space, I still keep the lines fairly narrow. 65 was a more or less arbitrary number that was somewhat influenced by the fact that I started on punched-cards, where the normal width was 72 columns.

Although I use the Java pretty-printer to enforce the text width, I also enable the "print width" option. It places a line down the editor view at the end of column 65 so I know
where things are going to wrap.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic