Community
Participate
Working Groups
I have set my tabs to be 3 spaces long: ---------------- public class C {<---place cursor here } -------------------- when you press enter class C { |<---cursor ends up here (8 spaces in) } ------------------- this looks like the same bug as 26590
PLEASE FIX THIS. It is really annoying!
I have investigated a litte further and have found that if you go into Window- >Preferences->Code Formatter->Style and untick "Insert Tabs for indentation, not spaces" then the problem is apparent. Once again I must insist that this is a really really annoying bug and I hope it is looked at by someone!
Further investigation has revealed that if I have set my Displayed tab width to 8 (Window->Preferences->Java->Editor->Appearance). If I set my displayed tab width to 3 then the problem does not occur. Therefore someone is using the wrong variable some place!
the method in file -------------- http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.ui/ui/org/eclipse/jdt/i nternal/ui/text/java/JavaAutoIndentStrategy.java?rev=1.28&content- type=text/vnd.viewcvs-markup&cvsroot=Eclipse_Project ---------------- private int getTabWidth() { if (fTabWidth == -1) fTabWidth= JavaPlugin.getDefault().getPreferenceStore ().getInt(PreferenceConstants.EDITOR_TAB_WIDTH); return fTabWidth; } ---------------- should be ----------------- private int getTabWidth() { if (fTabWidth == -1) fTabWidth= JavaCore.getOptions().get (JavaCore.FORMATTER_TAB_SIZE); return fTabWidth; } But I am not experience with eclipse development nor do I have rights to modify the code so could somebody check to see if this is correct and if so implement it.
Adapting priority.
Created attachment 3223 [details] Fixes Indentation Problems. The previous code was using the display tab size to calculate the indentation to use. The patch will now ensure that FORMATTER_TAB_WIDTH is used in instead.
The following are all dups of this: bug 28005 bug 29909 bug 30194 It's very annoying as now I need to have my displayed tab width set to my desired indent spacing of 2. I would like to use a tab width of 8 so that the JDK sources are readable.
I have created a patch for this bug. Its just a matter of time before somebody with commit privilages actually applies it to the source code. It is attatched to this bug report. If you can't wait you can try and check out the source code and apply the patch yourself.
*** Bug 30155 has been marked as a duplicate of this bug. ***
*** Bug 28005 has been marked as a duplicate of this bug. ***
*** Bug 30194 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of 29909 ***