How to set tabs and spaces to be visible by using the tab key to insert spaces in Java files in Eclipse
I don't like the indentation of tabs and spaces in a single source file.
Recently I saw only the lines related to a specific refurbishment tab and all the space files. What's more, tabs and spaces are mixed in one line.
Am I asserting something? It's also possible, but the coding person may not know whether he's putting tabs or spaces.
So, I thought that I should set not only "Whether to use tabs or spaces" but also "Visualize tabs and spaces".
--Environment
- OS : macOS Sierra Version 10.12.4
- Eclipse : Kepler Service Release 2 Build id: 20140224-0627
--Default JRE set: Java SE 7 [1.7.0_67]
In Java file, set so that 4 spaces are inserted when the tab key is pressed.
- Select the Prefernces dialog> Java> Code Style> Formatter.
- Click the [New ...] button to open the [New Profile] dialog.
--If you already have your own settings, you can use them.
- Enter an appropriate setting name in [Profile name:] and click [OK].
- Press [Indentation] and look at [General settings].
- Under Tab policy:, select Spaces only.
- Enter "4" in [Indentation size:] [Tab size:].
- Click [OK] to close the dialog.
- Click OK to close the Preferences dialog.
Set tabs and spaces to be visible
- Check the [Prefernces] dialog> [General]> [Text Editors]> [Show whitespace characters].
- Click the configure visibility link to open the Show Whitespace Characters dialog.
- Check the display location [Leading] [Enclosed] [Trailing] of the characters to be displayed [Space] [Ideographic space] [Tab].
- Click [OK] to close the dialog.
- Click OK to close the Preferences dialog.