Community
Participate
Working Groups
EG (24.08.2001 11:26:37) from EC: > > - When I set the Code Formatter to not use tab representation it still > > sometimes inserts tabs. Is this a known problem? > no, can you provide us with more details, so that we can track this as a > problem report. > [in another ide] opening the Java file I am editing and using CTRL-SHIFT-8 to display blanks and tabs (a nice feature): I will use '-' for a blank below and '=' for a tab. Here is the scenario. I start with: --protected void finalize() throws Throwable { ----FinalizeAddin(); --} Now I put the cursor right after the opening brace {, hit enter and start typing "//test" followd by a CTRL-S to save the file. I get: --protected void finalize() throws Throwable { --#//test ----FinalizeAddin(); --} The CodeFormatter has no checkmarks except for 'Insert a newline inside an empty block' shouldn't matter. The amount of spaces representing a tab is set to 2 and 'maximum line length' is 80. Since 'Indentation is represented by tab' is unchecked I would expect to see: --protected void finalize() throws Throwable { ----//test ----FinalizeAddin(); --} NOTES:
The code formatter is not involved in this extra tab added at the beginning of the line when a carriage return is pressed. This looks like a feature of the Java Editor. I don't see what I can change in the code formatter to change this behavior. If you format the source that contains tabs and spaces, the tabs are converted to the right number of spaces. Suggest to move to JUI.
Moved to JUI. The problem seems to come from a feature in the Java editor.
The tab is indented by the auto indent mechanism. The Java editor doesn't support using white spaces instead of tabs. We should remove the code formatter feature to use white space for tabs until the editor honors it. Otherwise it is too confusing to users. This is a change to the formatter preference page.
it's simple to change the JavaAutoIndentStrategy to honor the formatter settings. What should I change?
Fixing auto indent to honor the formatting option is good and we should fix it as you suggest. However, what do we do with leading tabs manually inserted by the user? The formatter will change them to blanks as well and the user would expect the same when this formattig option is set.
The auto indenter just copies the previous indent and avoids to do any counting of indention. I would leave it like that.
I agree that the auto indenter strategy should not change. It is doing the right thing. However, a user can still create indents manually by inserting tabs. The code formatter will treat them as leading tabs and replace them with spaces. What I wonder is whether this formatter options implies that tabs should be replace with spaces.
changed the JavaAutoIndentStrategy fix > 110025
Verified: User-created tabs are left as tabs. Additional indents are added as spaces if 'Indentation is represented by tab' is unchecked.