Show only trailing whitespace in IntelliJ Idea

2019-04-18 17:49发布

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?

3条回答
等我变得足够好
2楼-- · 2019-04-18 18:13

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.

查看更多
地球回转人心会变
3楼-- · 2019-04-18 18:17

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.

查看更多
男人必须洒脱
4楼-- · 2019-04-18 18:26

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.

查看更多
登录 后发表回答