ThatJeffSmith

Does SQL Developer Support ‘Word Wrap’ a la Notepad?

The quick answer: ‘Mostly.’

Simple question of the day – how do I get SQL Developer to word wrap like Notepad does? If you don’t know what I’m talking about, then here’s a screenshot of some text before and after word wrap is applied in Notepad:

No Word Wrap

Notice the horizontal scrollbar?

Word Wrap

Now I can see all the text without scrolling.

A SQL Developer Example

Here’s some text to play with:

Select '012345678901234567890123456789012345678901234567890' || '12345678901234567890123456789'
from dual;

That’s more than 80 characters and it’s broken up over multiple ‘words.’

With mostly out-of-the-box settings in SQL Developer, you’ll see something like this when you paste into a worksheet:

What do you mean, I have to scroll?

So what’s the trick? I don’t see a ‘Word Wrap’ toggle under View or Edit. You need to configure the formatter. This is available under the Tools – Preferences dialog.

This will approximate word wrap behavior in SQL Developer

You may want to match the ‘Max Line Width‘ formatting preference with your ‘Code Editor – Display – Right Margin Column’ preference. I have done so, putting both at 80. I’ve also set the margin color to a more distinctive red.

Now you need to format the text. So, no we can’t wrap the text as you type. But if you inherit some code from a developer who has a much wider display or set of formatting preferences, you can ‘fix it’ with a single command-sequence: ‘Ctrl+F7.’

A simulated ‘word wrap’ in the SQL Developer Worksheet using the Formatter

There are quite a few formatting preferences to dig through. I love that SQL Developer will format the text to the right to ‘preview’ the behavior of the preference you’re tweaking. This saves you from having to set the preference and going back to the worksheet to try it out.

What Is the Formatter Missing?

If you have any questions about how to get the formatter to do what you want, feel free to ask them here. We’re constantly tweaking the formatter to meet your needs and are evaluating enhancements for the next several releases.