This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
NB6 M10, Java 1.6.0_02, Linux/Gtk Because I want my indentation to be flexible (so one user can set a block indent to two spaces, another to four or eight), I told NetBeans to use tabs instead of spaces, and to NOT expand tabs to spaces. I have indentation/tab/whatever settings of four spaces per tab, which is my personal viewing preference. When I create a new class (for which NB uses a template), or when I use the alt-enter shortcut for "implementing all abstract/interface functions", however, NetBeans indents everything generated with spaces. Also, while in an earlier milestone I remember being able to insert tabs into the template (which were unfortunately ignored during expansion/use of that template, in NB6 M10 I can no longer even insert tabs into templates. Pressing tab inserts four spaces (whyever it should do that). This is about the only thing that annoys me with NetBeans (and the only area where Eclipse has very reasonable default settings). While it's pointless to argue spaces vs tabs, I think that the IDE should respect the user's code style preferences.
Reporter, please see also issue #66187.
Yes, thanks. I'm aware of the "hidden" tab setting, but even setting everything to 4 doesn't help. If I don't set the hidden tab setting, NB indents a 8-space tab when I press "tab", so I've set it to 4 for a while now, which at least does what I want for normal coding. Templates use spaces, though, as does auto-generated code. (Not sure, IIRC NB 5 used to work, but the new Java editor, which is otherwise great, broke things.)
I have to say that this issue is very irritating. It seems that the templates should be indentation-independent. There are many indentation settings and I'd expect NetBeans to honor them when inserting templates. It seems that an easy fix would be to strip indentation from templates and have NetBeans auto-indent them with its Reformat Code feature.
The "New From Template" action still uses the old IndentEngine instead of the new ReformatTask to format the newly created source. Reassigning to Mila.
*** Issue 118080 has been marked as a duplicate of this issue. ***
Yeah, 'Generate Code' seems to reformat created code properly. It's just when creating new java class the code is not reformatted. Honzo, any idea where this should be fixed? Is this controlled by java (in JavaDataObject or something else) or does the editor infrastructure have control over it? Thanks
Mila promised to fix it in issue #115983. *** This issue has been marked as a duplicate of 115983 ***