How To: Configure TABs in SQL Developer

thatjeffsmith SQL Developer 16 Comments

Tell Others About This Story:

Update for version 4.2 and higher.

As often happens, my ideas for blog posts are provided by end users asking for help. Sometimes I know the answer, sometimes I don’t. This is one of the latter cases. Chet AKA @oraclenerd asked me:

‘Tell me how to find the preference in sqldev to make a tab 2 spaces?’

I knew it had to be in there somewhere. This is a pretty basic setting for any word processor or IDE. Basically you want to control how many spaces are inserted when you hit the TAB key.

The default is ‘2.’

The problem with default settings is that they are likely to make half the users happy, a third non-plussed, and the rest genuinely upset. The idea is to shoot for something that offends the least number of users and aim for ‘the right thing’, kind of like Google’s ‘Do No Harm’ motto.

Since we can’t make everyone happy, we provide options for the end user to customize and fine tune their experience. The problem here was that it was REALLY hard to find this particular option. The search mechanism in the preferences dialog doesn’t reach the page where this particular setting was stored, and the label for the setting isn’t ideal.

So let’s get down to brass tacks and show you exactly how to configure this setting in SQL Developer.

Open the preferences, go to the Database page.

Easy enough. Now click on the ‘SQL Formatting’ sub page and then on ‘Oracle Formatting.’

The Formatting Options Page for Oracle Connections

Click on the ‘Edit’ button next to the profile dropdown control

You need to open up another set of preferences to access the tab option

Go to the Indentation page and inspect the ‘Spaces’ property

It’s currently set to ‘2.’ Change it to the desired setting. If I change it to 5, when I hit the ‘tab’ key, SQL Developer will insert 4 spaces leaving the cursor on the 5th curpos on the current line.

The Spaces preferences controls the TAB key behavior

You can easily observe the new behavior in the worksheet if you enable the ‘Show Whitespace Characters’ option under the ‘Code Editor’ and ‘Display’ page in the preferences.

Seeing is believing!

Update: Version 4.2 and Higher

Pretty much the same difference.

However, we completely changed the formatter – enough so that we couldn’t preserve your settings, including this one for the indent/tab stop. So you’ll need to reset it. And it’s in a different place now.


Tell Others About This Story:

Comments 16

    1. thatjeffsmith Post
  1. I notice this article is a few years old. Is this still how to set indentation settings in SQL Developer, or have they changed things around since this was written? I’ve been unable to find any more recent reliable sources. There was a forum post that said something about a Beautifier, but I wasn’t sure if that was what I was looking for.

    1. No, I’m looking specifically for a way to set the “tab” key to insert a certain number of spaces rather than a tab character. So this is no longer the way to do that, then?

      1. thatjeffsmith Post
    2. thatjeffsmith Post
      1. I did read the post, yes. Unfortunately, I am unable to check for myself to see if it still works this way; I’ve been asked to find this information for someone else.

      2. thatjeffsmith Post
  2. My Toad today crushed and not having time to take care of it today I switched to SQL Developer. All was fine ( especially that I worked in it some time ago ) but the code was 3 spaces tabbed so I didnt want to change it. I thought, its just a simple setting in preferences and thats it. How I was wrong. I went through many places many times in Preferences and did not find anything like Tab setting, I just couldnt believe it, it always was this simple 😉
    Thanks for the tip, I would never find it by myself 🙂

    1. thatjeffsmith Post
  3. When we want to edit Table/View from the List on the Left Hand Pane, then it pops-up a new window which allows us to edit a existing table/view, but doesnot allow us to multi-task until we close this window.

    Please suggest if there is any way to avoid this? Rather change the Preferences, and which could allow us to edit existing table/view and also open a new tab in Oracle SQL Developer and perform tasks?

    1. thatjeffsmith Post
    1. JeffS Post

Leave a Reply

Your email address will not be published. Required fields are marked *