Saturday, 15 May 2010

Prevent eclipse from removing whitespaces -



Prevent eclipse from removing whitespaces -

how can prevent eclipse removing whitespace within line?

example:

final map<string, string> capitalof = new hashmap<string, string>(); capitalof.put("france", "paris"); capitalof.put("italy", "rom"); capitalof.put("switzerland", "bern");

gets becomes after calling format (ctrl-shift-f)

final map<string, string> capitalof = new hashmap<string, string>(); capitalof.put("france", "paris"); capitalof.put("italy", "rom"); capitalof.put("switzerland", "bern");

you can edit behavior of java formatter in white space section of preferences (java - code style - formatter).

in case have rely on formatter tags turn off formatting of code:

@formatter:off capitalof.put("france", "paris"); capitalof.put("italy", "rom"); capitalof.put("switzerland", "bern"); @formatter:on

for work, off/on tags have enabled shown below:

eclipse

No comments:

Post a Comment