enhancement request

Rob van Rijen

Member²
Hi all,

I am working on a project where I update existing code. A lot of the pl/sql code has tab characters in it... I just hate them :)

I'd like to replace the tabs with spaces, but I can not see where the tabs are, because they are not visible.

Can PL/SQL Developer be expanded with a
 
This is a good request.

Here's something that can help until it is implemented. There are a some good freeware text editors that will convert tabs to spaces as well as show the tabs. For example, Crimson and ConText both do that. I've copied code to them, changed tabs to spaces and copied it back.

Of course, if the program is creating a tab delimited file or something, it wouldn't be so good to do, so just don't do it blindly!
 
Another workaround for now:
Find a tab somewhere, and copy it. Go to Edit->Find... and paste the tab character in the "Find & Replace" dialog. Click "Search". Now you can use Edit->Repeat Last Find to find them all.

(Using shortcut keys is obviously faster, but I think I changed mine from the defaults so I didn't want to list them here.)

And yes, Thanks Marco!
 
What about a "Tabs to Spaces" menu option as UltraEdit has it?

Another possible solution: If I have set my Preferences/Editor/Use tab charater=no,
would it be a good idea if PL/SQL developer does an auto-convert when the file is loaded? Isn't that what we want to get rid of this tabs? :-)

Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com
 
Marko (or anyone at allroundautomations),
Is there a web page that lists the enhancements and/or fixes expected in the future versions or PL/SQL Developer?

It'd be very helpful to know that in advance.
 
Hey guys, there is no need to autoconvert smth, I hate this stuff that happens not knowing it...
Use RexExp to do this:
for search use \t, for replace type how many spaces you need for one tab.
Be sure to enable RegExp feature.
 
Tabs, by the way, are better than spaces...
Tabs in PLSQLDEV can be shown as any amount of *spaces*, so you control look of the code, idents and stuff, but if you use space, well, space is space, one symbol, that's it... less flexible...
I like them...
 
I've always liked tabs, but I'm having to give them up for SQL and PL/SQL because no editor currently supports them for these languages. (I guess Vim could do so if I could learn its indentation macro language and submit a language pack, but life's too short.) It would be nice if PL/SQL Developer could do so, but if that is (as it seems) not possible then I agree it would be useful to have features for (1) highlighting them using symbols or colours, and (2) intelligently replacing them (though the regexp replace already works pretty well).
 
That's an interesting discussion about tabs. Tabs have been shunned where I work, because everyone had a different setting for how much space a tab took. It would look great on one person's computer and be all messed up on another. With spaces, it looks the same for everybody. I guess we all have preferences.

I was wondering what the regular expressions are. So far, I only know \t is tabs because of this forum. I looked in the manual and I can't find them. It just says to check the box and I can use regular expressions. Did I miss it?

Thanks,

Mike
 
> Tabs have been shunned where I work, because everyone had a different setting for how much space a tab took. It would look great on one person's computer and be all messed up on another.

No! Used correctly they do not break alignment. Unfortunately without a language-aware editor that supports tabs it takes a certain amount of discipline.

Obviously you would not use a tab after any character other than another tab or a newline, and ideally an editor would make it hard to do so by accident.

An editor that supported tabs would also switch from tabs to spaces at the right point in the line (i.e. directly under the start of an SQL statement) rather than blindly adding tabs up to the start of the text.

This is not a problem for procedural code such as (for example) shell script or indeed procedural sections within PL/SQL. It's SQL that needs blank-padding with odd amounts of spaces (not tabs), and AFAIK no editor exists that supports this.
 
so, what happens when you use a proportional font? tabs look all screwed up for me.

i agree with RobertK, "death to the tab button!!"
 
Comming from a Fortran77 background I've spent hours trying to figure out why some piece of code could not compile, finally figuring out that it was caused by the tabs I used instead of spaces.

Ever since then 'spaces + non-proportional font' has been the thing for me.

Then again, I don't like apple pie, whereas some others do :-)
 
While editing PL/SQL code, there are only a few things I still have to use my favorite editor (UltraEdit) for:

Removing CR/LF characters from a list to "flatten" it into a single comma-delimited string.

Trim trailing spaces.

Convert tabs to spaces.

Powerful column-mode editing.

Quickly copying the full path and filename of the current file to my clipboard (which I now do from within xplorer2 from zabkat). This is used when running SQL scripts from the Command window or from SQL*Plus.

And powerful, regexp search/replace in files that can recurse through subdirectories to change all code for a given project.

If PL/SQL Dev could include these functions, I could kiss my text editor goodbye.

bc
 
> so, what happens when you use a proportional font? tabs look all screwed up for me.

Now you've lost me. What does a proportional font have to do with tab alignment? Say the start of a block of code is 3 tab stops in from the margin. That will come to whatever width 3 tabs stops are displayed as in your editor, regardless of the font. It will still be vertically aligned with anything else indented by 3 tab stops.

But when would you look at code in a proportional font anyway? A proportional font screws up your alignment on its own, regardless of tabs. For example,

Code:
SELECT col1
     , col2
FROM   sometable
I need col2 to be aligned under col1, which a proportional font would not do.
 
To Marco.

bcoulam said:
Trim trailing spaces.

Convert tabs to spaces.
When will this be implemented? I use an editor like EditPlus for these special tasks, and I assume that the developers of PL/SQL Developer do not want to throw us all in the arms of other editors?

A lot of our older code is edited in Wordpad (sigh!) and tabs are used extensively. The tab size must somehow be stated before conversion, editors like Notepad use a tab stop of 8 whereas for instance Wordpad uses 6. This must be configurable.

Please note: replacing tabs with spaces is not just a simple matter of search and replace. In an editor with a tab stop of 8, a line of code that is 11 characters long followed by a tab and more code would have the result that the rest of the code begins at column 16 (always a multiplum of 8) and not just 8 columns to the right of the current position. This is important to remember so tabbed code look the same after conversion.

I will look forward to this enhancement :cool:
 
Create a beautifier setup with no tabs (disable smart tab and all that stuff).
Select this file in Options and beautify your text. This is the 1st thing I do when I start working on a file with tabs.
 
I prefer TABS and i use the replacement of spaces into tabs very often in order to keep our shared sources readable;-)
 
> I prefer TABS and i use the replacement of spaces into tabs very often in order to keep our shared sources readable

Sorry to be three months late with this, but the problem with tabs is that SQL statements are not block-structured (unless you use a very specific code layout, as Jonathan Lewis does for example, though I'm not sure I like it personally). You can't just replace every n spaces with a tab character, even if you know the indent size that was used and the author kept to it, because it will mess up SQL statements like

Code:
SELECT blah1
     , CASE blah2
           WHEN 1 THEN 'banana'
       ELSE
           'hatstand'
       END AS col2
FROM   sometable;
This is where a SQL-aware editor would track the position of the start of the statement (in this case the keyword 'SELECT', although it could also be INSERT/UPDATE/DELETE/WITH/MERGE etc) and apply tabs up to that point and spaces after it. Otherwise if you just replace every 4 spaces in the leading position (again, you don't want to change them anywhere else they may appear in the text) the second line will get 1 tab + 1 space, the third line will get 2 tabs + 3 spaces and so on.

Even if you fix all this manually, there is nothing to stop the next person adding a line in an editor with a dumb smart-tab feature and breaking the whole thing.
 
Back
Top