Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one show trailing whitespace in eclipse?

I'm looking for something like (setq show-trailing-whitespace t) in emacs, where all of the trailing whitespace is blindingly clear, ie highlighted. My searches for this kind of option have mostly turned up examples of removing all trailing whitespace, which is not at all what I'm looking for.

like image 865
nnythm Avatar asked Jul 21 '12 22:07

nnythm


People also ask

What is trailing whitespace?

Trailing whitespace. Description: Used when there is whitespace between the end of a line and the newline.

How do you fix trailing white spaces?

Hover the mouse on warning in VS Code or any IDE and use quick fix to remove white spaces. Press f1 then type trim trailing whitespace .


2 Answers

Click on:

Window > Preferences > General > Editors > Text Editors 

Then click on the link "whitespace characters" to specify what should be shown.

like image 63
Reimeus Avatar answered Sep 25 '22 17:09

Reimeus


What I settled on for this takes a plugin but isn't bad. Then your trailing whitespace will show up as an eclerror/warning in the file.

1: eclipse checkstyle plugin 2: make a checkstyle config as generous as you want. if you ONLY want trailing whitespace:

<module name="Checker">   <module name="TreeWalker">     <module name="Regexp">       <property name="format" value="[ \t]+$"/>       <property name="illegalPattern" value="true"/>       <property name="message" value="Trailing whitespace"/>     </module>   </module> </module> 
like image 39
Benny Avatar answered Sep 25 '22 17:09

Benny