SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
FR: jump to region start/end

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
FR: jump to region start/end
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2100

Post FR: jump to region start/end Reply with quote
Many years before I used bookmarks frequently but always felt them a bit limited:
- only being able to use 10 of them is extremely restraining. That works for a small code base but becomes "tight" as the code gets more complex
- the preview seemed a great feature at first but having to switch to the mouse to hover over them just to see what's there is sort of a handbrake
- the hotkeys available for setting them (alt+Num0..Num9) was always somewhat out of reach but now that I haven't used keyboards with Numpad for, well, also many years, I have to use the mouse to do that
- the same applies to jumping to them

All those reasons above led quite quickly to the point where I had "outgrown" this feature, it no longer provided any significant advantages, and in certain cases using them was way slower than just living without them. I abandoned the feature a long time ago.

And then came the regions which were quite an improvement over the simple bookmarks, though still limited. There's a vast amount of untapped potential in there, hiding and waiting to be set free.
Regions have a quick jump feature similar to bookmarks if one has the patience to hover the mouse cursor over the syntax/indicator bar searching the region wanted. Another workaround is using the incremental search, but that requires the region names to be somewhat unique so that the search does not return false positive. Also, the incremental search only works forward, thus one has to jump to the top of the editor, and it is strict at the same time, meaning that one has to know the exact name of the region or else it won't find anything. These hindrances behave like shackles.

What I had in mind as an improvement is the following: SA could
- maintain a list of the entries for #region [name] / #endregion (matching the corresponding opening #region or also by name) pairs
- have a new type of hotkey triggered popup (like the Show SQL Assistance or the Show Command Selector) that allows filtering on that list the same way it filters common SQL stuff with the same name matching methods AND jumping to the selected entry.

This could be navigating-the-code on steroids.
Sat Feb 06, 2021 6:08 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
If I understand correctly you are describing a popup window listing all defined regions and allowing you to filter on them. That sounds to me like a low hanging fruit. The regions are already marked on the right side bar, and can be jumped to when marks are clicked. I imagine it should be easy to show them in a popup. I'm going to submit an enhancement request on your behalf for adding new code regions popup with a hotkey to trigger it.


In a mean time maybe you will find useful mapping hotkeys to the existing code folding features available in the Options menu -> Key Mapping -> Text folding. If you use regions extensively, adding a hotkey like Ctrl+Alt+C to "Collapse all blocks" and Ctrl+Alt+E to "Expand all blocks" and maybe Ctrl+Alt+T for "Toggle current block", you would be able to show the entire script like a menu with regions, similar to what you see on my sample screenshot below. Up and Down navigation keys can move you up and down by region, while the toggle current block hotkey can expand/collapse the region you navigated to.



Sun Feb 07, 2021 3:15 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2100

Post Reply with quote
Thank you very much for considering my request.

As for the meantime workaround, I like the code folding feature very much, and I'm already using it extensively, though not with the hotkeys you mentioned (anything with Ctrl+Alt would interfere with my keyboard layout). Also, I use Toggle nearest block and Collapse all but current block instead of Toggle current block.

Where that method fails, though, is nested regions, either in other regions or some parts of code that also fold, like BEGIN...ENDs, IFs, CREATE PROCEDUREs, etc. I don't know whether you ever intended those to be nested, but they can be, and that's marvelous. Except that when you fold all, folding works not only on regions but on those types of code as well, meaning that it will fold code blocks, and the nested regions will be hidden, thus cannot be navigated using the Up/Down arrow keys. Also, the Incremental Search does not work well on folded code. I've currently no good ideas on how to make those better but there's definitely room for improvement there.

So I still find it faster to jump to the top and use Incremental Search.
Sun Feb 07, 2021 8:09 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
Thank you. Finding and folding nested blocks and regions is supported by design. Blocks are more generic than regions, but don't have user chosen descriptive names.
In my simple example I meant using adjacent top level regions, so they can be used as an accordion. But I do understand with long complex scripts it might be difficult to keep them that way and provide much granularity.
Sun Feb 07, 2021 10:28 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.