Not to start a religious war, but white space in your code can cause havoc when you’re doing code compares and versioning.
Some folks like tabs, others prefer to control how their code looks regardless of the editor’s tab display options.
From what I can tell, SQL Developer’s code editors won’t even let you insert a tab into them – they auto-convert a tab into 2 spaces.
But, if you’ve pasted tabbed code in, they’ll remain.
Tip: Set your code editor display preferences to show whitespace characters – that way you can see tabs and spaces CLEARLY.
The Formatter Can Tabs to Spaces When Indenting
If this post seems familiar, it’s because I’ve talked about this before. But we’re changing the formatter for version 4.2, and @oraclenerd reminded me in his awfully nice review of SQLDev that some folks rely on this feature a LOT. It still words as expected in this regard for the next version 🙂
One Last Tip
If you really, really hate tabs – to the point that you do cool stuff like this:
Our team has a similar rule, and file checked-in w/fewer than 10% of the code being comments is REJECTED.
Anyways, if you do stuff like this, and forget to format your code…when we generate SQL code for database objects, if you have the Pretty Print option enabled in the preferences, it may insert TABs.
When is v4.2 coming?
Soon. I’m only teasing it because it’s on the horizon. Stay tuned 🙂
Doctor Evil has an evil point!
That is a drawback to plain-text editing … one cannot see tab chars.
I am always horrified with people’s Microsoft docs … the amount of abuse formatting takes … and the mis-creation of forms! Shocking.
Tabs should be converted to 3 1/2 spaces for sql scripts and 2 1/3 spaces for packages, depending on the font. 🙂