Formatting vs Changing Code as You Type

thatjeffsmith SQL Developer 13 Comments

Tell Others About This Story:

Reviewing my timeline, I came across this gem from Franc.

Franck isn’t alone – a lot of people hate it when their code doesn’t look the way they want it to.

Many folks know about our formatter, and how to use it to get their IDENTIFIERS UPPER-CASED.

But did you know you can have SQL Developer change the case of your code as you type it?

Here’s a 10 minute video where I show how to setup the formatter and the other code editor preferences to get your code, the way you want it.

The Video Demo

Tell Others About This Story:

Comments 13

  1. Jeff,

    I experience inconsistent Completion Insight behavior. I prefer “Upper Keywords, Lower Identifiers” and set Completion Insight “Change case as you type” to that value. As I type and hit enter, the preceding line is correctly formatted, for a while. Then it changes to another random setting. One time it can be “Upper Case” while another time might be “Lower Case”. After each ghost change, I go back and reset it to my preference, only to have it change again some time later. I’m using Version 4.1.3.20 but this has been going on for a number of releases.

    Any suggestions for what I may be doing wrong or overlooking?

    1. thatjeffsmith Post
      Author
        1. thatjeffsmith Post
          Author
  2. Why do I get different results when I format a block of text, as opposed to writing a line of code and hitting enter to go to a new line? It seems that my settings should be universal over these two methods of operation?
    john3

    1. thatjeffsmith Post
      Author
  3. Any way to get boolean connectors under “where”s to indent?

    where
    IDX.TABLE_OWNER = ‘TABLE_OWNER’
    and IDX.OWNER = SEG.OWNER
    and IDX.INDEX_NAME = SEG.SEGMENT_NAME
    group by
    IDX.INDEX_NAME,
    IDX.INDEX_TYPE

    1. dang it, the indents were removed in my sample.

      After formatting in SQL Developer, the first predicate after the WHERE is indented, but subsequent ones (with AND or OR) are not. Would be nice if they would all line up below the first one.

    2. thatjeffsmith Post
      Author
  4. Since when is anything case sensitive in ORACLE SQL?

    Keywords are completely case insensitive, and all identifiers are automatically UPPER CASED unless they are surrounded by double quotes. When creating code, it is important to be able to easily differentiate between keywords and identifiers. Most formatters that do that differentiation allow either for keywords to be all upper case, and identifiers to be all lower case, or vice versa.

    Identifiers have the potential to be case sensitive, but any coder who takes advantage of that possibility, is not someone that I would want creating code for me.

    1. thatjeffsmith Post
      Author

      That’s not what this post is about. Feel free to talk to Franck about it – click on the picture/twitter link. The conversation went on awhile and touched on what you’re talking about.

      I hate case sensitive object names in the database, for what it’s worth.

Leave a Reply

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