How can we improve SQL Prompt?

A new type of snippet to be invoked not by keyword, but rather by a hot-key. This would open up a new style of snippet expansion

The goal of this feature would be to allow "wrap arround code" to be implemented by snippet. You would select a block of code, press a hot key and be presented with a list of hot-key snippets. When expanding the snippet, the selected code would be loaded into a placeholder $selection$, then deleted, the snippet would then expand. Example

Snippet is "sum($SELECTION$) as TOT_$SELECTION$ "

by selecting a variable name you would be a couple of keystrokes away from totalling it.
Another variation is to have a 2nd hot-key that can be set to directly execute a single specific hot-key snippet. Then if I have multiple fields to be summed , it's select, hot key, select, hot key ....

Once that works here more ... Have placeholders $GROUP$,
$WHERE$, $ORDER$ etc. As the snippet expands these keywords reposition the code expansion to the specific clause, adding it if needed

Here's what can be done with this new option

Snippet " $SELECTION$ , count(*) as occurs $GROUP$ $SELECTION$ "

The editor has the following code

Select fld_name from table_name

if you select fld_name and invoke this snippet you will get

Select fld_name, count(*) as occurs from table_name
order by fld_name

You would also need a placeholder $IFEXIST$ for adding AND and OR's to where statement depending on if the snippet has to add the Where clause after the $where$ placeholder or just finds it. Snippet code would then go at the end of the where/order/group clause

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Ed KleinEd Klein shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Ed KleinEd Klein commented  ·   ·  Flag as inappropriate

        Sorry I had a typo in my writeup the last example of the snippet expansion should read

        Select fld_name, count(*) as occurs from table_name
        Group by fld_name

      Feedback and Knowledge Base