Search code examples
intellij-ideawhitespace

Show whitespace only on selected text in IntelliJ IDEs?


Like how it is in Sublime Text. Currently I've only found the ability to show whitespace permanently.


Solution

  • Since version 2023.1 there is an option to enable this in the settings under Preferences | Editor | General | Appearance.

    Screen shot of the Show Whitespaces setting

    For older version an interesting trick to get the desired effect has been posted in the feature request.

    1. Enable Show whitespaces in File | Settings | Editor | General | Appearance
    2. Set the Text | Whitespaces foreground color to be the same as the editor background color in File | Settings | Editor | Colors & Fonts | General

    Result: Whitespace is invisible by default, but when the text is selected the background color will change and the whitespace becomes visible.