• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set the formatter in Eclipse?

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Yeast devil! Back to the oven that baked you! And take this tiny ad too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic