You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Eric Bresie <eb...@gmail.com> on 2021/03/03 16:05:30 UTC

Re: SQL Autocomplete

Current status (and some thoughts thrown out for input/review)..

 I've got the "Connection Error dialog" disabled for now (as with it
enabled it more or less prevents any autocompletion to occur).

I have an initial "Hint" showing up on a file when no Connection is defined
or available.

I'm starting to work on adding some "Fixes" for the Hint(s)

My proposed "Fixes" are:
(1) Create a new Connection -> Open the Connection Wizard
Suspect using some flavor of ConnectionManager's showAddConnectionDialog in
the "Database Explorer" project for the "Connection Wizard" may help here

(2) Select a Connection -> set the applicable defined connection
Suspect using ConnectionManager's getConnections() for getting lists and
selecting from that may help here

(3) Connect to Connection -> for a given connection actually
This may overlap or be a subcase of (2) since activating the connection may
occur there as well.

Suspect usingConnectionManager's getConnections() for getting lists,
displaying/selecting from that, and then ConnectionManager's connect() to
"activate the connection"

There had been some comments in one of the tickets about the metadata used
and populating it being time consuming to load all the applicable DB
metadata, so at the same time as the "Connection" activity, maybe the "DB
Metadata" could be loaded at that time.

(4) Setup Database Driver  -> open "Driver Window" to establish driver
Suspect using JDBCDriverManager and showAddDriverDialog may help here.

Not sure if some of this goes beyond the scope of the original tickets I'm
working on but thought this approach may be more in line with the
"Hint/Fix" paradigm and may be more user friendly.  I figured I would put
it out there for comments.

Eric Bresie
ebresie@gmail.com


On Wed, Feb 24, 2021 at 2:38 PM Eric Bresie <eb...@gmail.com> wrote:

> Have not implemented yet, but was thinking of a slight change in behavior
> which I wanted to see what others think or if it's really out of scope of
> the changes.
>
> When no connection is defined or available, rather than triggering the
> Error dialog (which prevents further activities), handle the no connections
> where applicable and add a Glyph indicator on the line with possible fixes
> to create a connection or select any available connection (similar actions
> mentioned previously).
>
> More to follow
>
> Eric Bresie
> ebresie@gmail.com
>
>
> On Sun, Feb 21, 2021 at 1:52 PM Eric Bresie <eb...@gmail.com> wrote:
>
>> Okay the previous helps a great deal...
>>
>> I've updated to the points where it basically ignores the db connection
>> aspect (for now) and allows SQL autocomplete to work so far.
>>
>> I'm emphasizing the case when there are no connections for now.  When
>> there are no connections available, I wanted to add some connection options
>> (i.e. create, select connection, logon to connection, etc.).  Figured
>> during this context it could establish connection and populate the metadata
>> at that time.
>>
>> How does one link up an item to do another activity like open up another
>> dialog (i.e. for "create" link to "New Connection Wizard") based on a given
>> selected item?
>>
>> Eric Bresie
>> ebresie@gmail.com
>>
>>
>> On Sun, Feb 14, 2021 at 3:02 AM Matthias Bläsing <
>> mblaesing@doppel-helix.eu> wrote:
>>
>>> Hi Eric,
>>>
>>> Am Samstag, den 13.02.2021, 18:45 -0600 schrieb Eric Bresie:
>>> > As a first bug fix, I thought I’d  try working some on the SQL
>>> > Autocompletion related issue like
>>> >
>>> > NETBEANS-188 Please add support for code completion while typing
>>> >
>>> > [...]
>>> >
>>> > What is the best approach to start on this?  In the SQL Editor
>>> project, I
>>> > find a number test cases like the one for select but I’m a little
>>> unclear
>>> > of the flow for how key input ends up in the autocomplete logic and
>>> how to
>>> > determines the tokens for use in that and where the check for the
>>> > connection happens.
>>>
>>> the starting point for the code completion is in SQLCompletionProvider
>>> (module SQL Editor). The provider is registered in the layer
>>> (layer.xml, line 56). if I understand the sequence correctly, first
>>> #getAutoQueryTypes is invoced to check whether a popup with suggestions
>>> should be shown without the user explicitly asking for it.
>>>
>>> If either #getAutoQueryTypes return a non-zero value or the user
>>> explicitly asks for completion, #createTask is invoked with the
>>> requested type. In case of SQL it is
>>> org.netbeans.modules.db.sql.editor.completion.SQLCompletionQuery.
>>>
>>> I see options to provide quick completion based on SQL grammer, with
>>> additional completion when a db connection is established.
>>>
>>> Does this help already?
>>>
>>> Greetings
>>>
>>> Matthias
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: dev-help@netbeans.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:
>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>
>>>
>>>