Kezz
Kezz

Reputation: 1678

Show only trailing whitespace in IntelliJ Idea

So I've recently moved from Eclipse to IntelliJ IDEA (Ultimate Edition) and I'm feeling fussy about whitespace.

At the moment I've set IntelliJ IDEA to show me whitespace, and it looks like this: IntelliJ IDEA whitespace

Eclipse would show the same code block like this: Eclipse whitespace

Is there anyway I can make IntelliJ IDEA only show trailing whitespace, just like Eclipse can?

Upvotes: 19

Views: 6445

Answers (3)

CrazyCoder
CrazyCoder

Reputation: 401887

Most recent IntelliJ IDEA versions do support showing only trailing whitespaces:

trailing

Original answer from 2013:

IDEA has no this feature, but you can enable an option to strip trailing whitespace on all lines automatically and forget about this problem.

Upvotes: 23

tobik
tobik

Reputation: 7198

I would like to extend the existing answers.

As already mentioned, you can now show trailing whitespaces only (Settings → Editor → General → Appearance → Show whitespaces).

Unfortunately, in the Dracula theme those whitespaces are barely visible. What you can do, though, is to pick a better, more distinct, color (Settings → Editor → Colors & Fonts → General; then pick Text and Whitespaces). For some reason, you cannot change the background color which would be a great help.

Upvotes: 15

Giovanni
Giovanni

Reputation: 352

As the question and the accepted answer are a little old, it's worth mentioning that recent versions of IntelliJ IDEA (only sure about v15) do support showing trailing whitespace only.

The setting can be found in Settings → Editor → General → Appearance → Show whitespaces. The options are Leading / Inner / Trailing.

I came upon this question searching for more granular whitespaces settings (e.g. show only spaces) and thought this clarification would help others.

Upvotes: 11

Related Questions