Autocompleting SQL

I expect getting the SQL autocompletion behaving decently, in all conditions, is going to take a lot of time, and a lot of trial and error.

Autocompleting SQL

Support for code completing in database managers is terribly bad. DataGrip is the best I have seen, but let's take a look at how I plan to improve the situation in the upcoming SQL App.

SELECT

When you just start typing, there is no FROM clause yet. So, we should be getting column name suggestions from all tables and views in the database. Optionally, FROM clause should be automatically generated and updated as we continue adding column names.

FROM

Adding a join should automatically add correct join conditions based on the foreign keys. I assume database managers don't query metadata in depth and this don't have enough information as you type.

CTE

Common table expressions should absolutely be fully supported.

Nesting

In a complex SQL statement (and by complex I mean even ones spanning several screens - and yes, I have seen such statements), at any caret location we should be offering everything declared in that specific scope. And scoping does get complex.

Modifiers

Multi-select. Perhaps Ctrl+Shift+Space should show a list of checkboxes. We'll see how that looks.

Prioritization. We really don't need an AI to have useful suggestions. Just offer something I type all the time first.

Functions and procedures

Completing a function name should display the function info in a popup. Completing its parameters should display parameter info and bold out the declaration as we type. And the popup should have a link to the function documentation.

This shouldn't really be said, but I think more GUI tools have autocomplete which actively obstructs typing than the one that's used. If I type and don't press TAB/ENTER, don't mess up with my typing!