When showing whitespaces, is it possible to show only tabs and not spaces?
Answered
Our code base style requires us to use spaces instead of tabs, but some IDEs use tabs by default and some people end up using tabs without realising. It is my job to alert them during the code review phase when I see this kind of stuff and I've been using IntelliJ and SonarLint to make my work easier.
The problem is that if I make it show all whitespaces, it becomes too visually polluted. Is there a way to only show tabs, so it would be easy to spot the code style mismatch?
One thing I tried was to change the colour of whitespaces to the same colour of the editor's background and uncheck the inheritance for tabs but it didn't work (I even tried an absurd colour just to see it happen, but nada)
Thanks
Please sign in to leave a comment.
There seems to be no way to show only a certain type of whitespace symbols.
Unfortunately, it is a known bug. Please follow https://youtrack.jetbrains.com/issue/IDEA-245152 for updates.
If your team uses IntelliJ IDEA for developing projects I'd recommend you configure Settings Repository in order to sync Code Style and other settings across all team members. Please see https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html#settings-repository .
Thanks, Egor. We try to be as "IDE agnostic" as possible. We incentivise the use of IntelliJ, but it's not a rule. Some people use IntelliJ, others use Eclipse and others use VSCode. We don't have a lot of code style rules. Basically spaces for indentation and UTF-8 file encoding. But I will take a look on your suggestion. Seems like an interesting idea.
For now, I found a good enough alternative. I made whitespaces just a little bit lighter than the background, so spaces won't be distracting and I'll be able to notice the tabs:
Thanks!