Start a new topic

Code Folding Regions

I realize there is already a feature request for code folding, but I couldn't figure out how to add my 2 cents to it.

Being able to code fold is the main thing holding me back from fully adopting DBVisualizer as my only SQL developer tool. In SSMS, there is a purchasable add-in (SSMS Tools Pack) that adds code folding regions to the UI. As the developer, I can add my own regions to any SQL code by wrapping it in a special comment that the add-in looks for.  It is similar to the way Microsoft Visual Studio does it out of the box for all languages.  To start the fold, just add "--#region PLACE HUMAN COMMENT HERE". To end the fold just add --#endregion. The add-in parses the SQL first and allows the user to fold/unfold that region. I have attached images from SSMS

Since "--" as a comment line is ANSI standard (at least I think it is), it seems this could be used for any SQL for any driver. It would just be the UI looking for this signature. The actual SQL parser would ignore the lines since they are just comments.

Again, just my 2 cents.


(76.9 KB)

Hi Eric,

DbVisualizer offers code folding, but it is based on selections rather than special comments:

Not sure if you were aware of that feature.

Best Regards,



Yes I am aware of that feature. The problem is the folding doesn't get stored in the file I am editing. After I close out a file all folds are gone. Also, as soon as I unfold that fold is gone too. So even in the live file remembrance of the fold is gone.

I do a lot of ETL in SQL and having regions folded out makes it much easier to focus on the sections I need. Folding makes for a good abstraction layer.


Hi Eric,

Okay, I understand. I have opened a ticket for us to look into this.

Best Regards,


Hi Hans,

What is the status of this ticket? In our previous SQL editor we had this feature. We would love to have this feature in DBVisualizer.

Best regards,



I would love to have folding based on:

  • Indention
  • Code elements (e. g. fold an entire subselect)

Kind regards


jEdit uses some marker triangles at line number area (jEdit calls it the gutter). 

There is a simple context unaware folding in the editor in DbVisualizer. We have an open ticket to improve this. Reason it hasn't been made is that we are looking into the editor in general.

Login or Signup to post a comment