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.
Use tabs instead of spaces for formatting Eclipse uses tabs for formatting, which makes files much smaller I want this feature in netbeans. Plz add it as soon as possible. If possible put a check box on options -> Editor -> Formatting -> Tabs and intents -> "Use tabs for formatting" Also add a feature called tab size, which specifies the distance that a tab takes.... Product Version = NetBeans IDE 7.4 (Build 201310111528) Operating System = Windows 7 version 6.1 running on amd64 Java; VM; Vendor = 1.7.0_45 Runtime = Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Created attachment 142776 [details] IDE log
Add tabs in next line instead of tabs
Both options are already present - they are called Expand Tabs To Spaces and Tab Size
/** Sample code which I typed */ package com.dalton.test; /** * * @author DaltonD */ public class FormatTest { public static void main(String[] args) { System.out.println("Dalton"); for (int i = 0; i < 10; i++) { System.out.print(i); System.out.println(i + 10); } } } /** Sample code which I formatted */ package com.dalton.test; /** * * @author DaltonD */ public class FormatTest { public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.out.println(i); } } } /** Sample code which I typed contains only tabs for intention So when I format it, the content of file must remain the same but as you can see, tab before "public static void main(String[] args) {" and "System.out.println(i);" changed to spaces In my system, Expand tabs to spaces is unchecked Number of spaces per intent is 4 Tab Size is 8 This problem gets fixed if Number of spaces per intent and Tab Size is same */
The problem is indentation level, the formatter is set to 4, but the tab size is set to 8, so it will add spaces if the tab is too long. To obtain desired formatting style set indentation level to 8
I think if Expand tabs to spaces is unchecked then, 'Number of spaces per intent' should change to 'Number of tabs per intent' Similarly in the case of Continuation Intentation Size, size should be specified as tab count Also convert existing spaces to tabs during formatting
No, this way is more flexible
ok then but atleast add a feature to convert spaces to tabs when formatting. Eclipse has this feature
convert spaces to tabs, whenever possible (eg:- when Number of spaces per intent and Tab Size is same)
Space to tab conversion is working in java files when Number of spaces per intent and Tab Size is same, but with one problem for continuation intentation there should be 2 tabs. but when i format the source I see only one In my system (for all language settings and for java. Other languages use all language settings) Tab Size is 4 Number of spaces per intent is 4 Continuation intentation size is 8 In the case of jsp files, spaces are not getting converted to tabs at all
I like to suggestion that tab option be selected by default instead of space. It's difficult to navigate code with arrow keys when space is used instead of tabs. I don't understand why netbean decided to use space, if there is a good reason for it I like to know. All other IDEs use tab by default. Lets follow the standard trend in this case.
(In reply to runiter from comment #11) > I like to suggestion that tab option be selected by default instead of space. Go To Tools->Options->Editor, Formatting and uncheck "expand Tabs to Spaces" Then use Tab to insert tab sybmol. Btw, View->"Show unprintable symbols" also helps to see what is in text > > It's difficult to navigate code with arrow keys when space is used instead > of tabs. You can use Ctrl+LEFT/RIGHT to speedup even in text with spaces.
Thanks, I'm aware of all those options that are available. But my point is that by default I shouldn't need to do all that. By default, NetBean should behave like most other IDEs by using tabs. Why put developers though the pain of resetting format option everytime they install netbean in a new computer? Who makes the decision about the default values of these options. I think it should be put to vote.