[
https://issues.apache.org/jira/browse/NETBEANS-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17284303#comment-17284303
]
Eric Bresie commented on NETBEANS-188:
--------------------------------------
I kept on looking for this comment which appeared to be in the PR attached to
this. I wanted to copy it here because it had some details I thought would be
of interest on this ticket.
h3.
[!https://avatars.githubusercontent.com/u/44434629?s=60&u=332e8788caf6a41f2cdaff1e9a28e1150e326e4c&v=4|width=20,height=20!|https://github.com/peedeeboy]
*[peedeeboy|https://github.com/peedeeboy]* commented [on Dec 11,
2020|https://github.com/apache/netbeans/pull/2558#issuecomment-743103282] •
edited
|[@ebresie|https://github.com/ebresie] - DB metadata in NB is fetched lazily
and cached as required, and this appears to be a very deliberate engineering
decision in the existing code. Perhaps it would make sense to fetch more (e.g.
table / view names metadata) at connection time, but what is unfortunate, is
that the metadata doesn't currently appear shared between all components that
need it.
e.g. monitoring an Oracle session I can see that if I expand a Table node in
the DB explorer, the DB gets queried for the Column metadata. If I then type
{{[tablename].}} in the SQL editor, it gets queried again for Code Completion,
rather than the Column metadata that has already been retrieved being re-used.
And vice-versa.
There's a list of SQL-99 keywords in
{{org.netbeans.modules.db.api.sql.SQLKeywords}} which are used by the SQL Lexer
for syntax colouring (and some other places in NB, like preventing JPA entities
being created with reserved keyword names in JEE), but not SQL Code Completion.
{{org.netbeans.modules.db.sql.editor.completion.SQLCompletionQuery}} has
hard-coded Keywords for the completion contexts it understands (basic CREATE,
SELECT, INSERT, DROP, DELETE scenarios etc.), and gets the database metadata
for schema/tables/columns...
To me, these are bigger issues, and this PR is a quick win-win (if
[@isarthur|https://github.com/isarthur] could take a look at those couple of
bits I mentioned) as: # It solves the JIRA ticket, making the existing (albeit
limited) SQL Code Completion popup automatically, for those who want it
# Enables users to disable to disable SQL Code Completion querying the DB for
metadata completely, for those concerned about it (e.g.
[@matthiasblaesing|https://github.com/matthiasblaesing] ).
Apologies all for butting in on this PR. I'll take a step back now.|
> Please add support for code completion while typing
> ---------------------------------------------------
>
> Key: NETBEANS-188
> URL: https://issues.apache.org/jira/browse/NETBEANS-188
> Project: NetBeans
> Issue Type: Improvement
> Components: db - SQL Editor
> Affects Versions: Next
> Reporter: Christian Lenz
> Priority: Major
> Labels: pull-request-available
> Attachments: screenshot-1.png, sqlCodeCompletion.gif
>
> Time Spent: 2h
> Remaining Estimate: 0h
>
> Afaik, the SQL Editor, is the only one, where you don't have code completion,
> while typing. It only appears after you hit ctrl + space, which is weird. It
> should be there per default. If not, there should be an option that code
> completion should always be possible, in any cases and you can deactivate it,
> if you don't want it.
> For each keyword, table, view whatever, I have to type a character and hit
> ctrl + space. It would be very nice to have the same code completion feature
> as in java or other languages, that the code completion comes up, while
> typing. For example:
> Type "S" -> code completion should come immediately and should show you the
> results. Same for everything like tables, views, databases, aliases and
> columns.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists