Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fully qualified completion #1433
Describe the new feature
I may be overly paranoid, but I write SQL with fully-qualified names. That is, with all
This is future-proofing - it guarantees that new SQL keywords and table fields won't require
Completion in the editor should support this style. Currently, it's awkward - accept a
What I'd like is an editor preference that would cause autocompletion to:
E.g., "tablea"."key" "tableb"."key"
For people who work with databases maintained by people with different opinions, it would be ideal if the preference was remembered per-database - but that's not essential.
Please answer these questions before submitting your feature request.
Is your feature request related to an issue? Please include the issue number.
No - unless you consider usability an issue.
Does this feature exist in another product or project? Please provide a link.
Do you have a screenshot? Please add screenshots to help explain your idea.
I've made some changes that might be of interest for you. They should help with the style that you are using, although it is not implemented exactly as you propose. The details are in the commits linked to this issue, but summarizing:
Could you give it a try with the tomorrow's nightly and provide your feedback?
I'd also like to add completion for the quotes, that is, if the identifier was started with a quote, the completion should also add the closing quote, but that doesn't seem to be supported by QScintilla, the editor library, that we are using, so the user is still responsible to add the starting and ending quotes. The drag and drop will help on that regard, though. Nevertheless I've raised a question in their mailing list, and they might suggest a solution.
Thank you for the effort. Sounds like progress. I will give it a try on real data when I can - I'm away from my databases.
I'm not sure I'll like drag and drop on a machine with a touchpad (tap and a half) - it can be temperamental, and adding the manipulation of Ctrl likely makes it more difficult.
I created a toy database (one table, two fields) on my notebook PC.
I found some unexpected behaviors.
I can't find the option that you mentioned in the schema dock, or in preferences. I downloaded today (14-Sep), but the version is 8-Sep, Perhaps the nightly builds are stalled? In any case, it's still after your note.
In each of the following, I'm in an Execute SQL window, SELECT has been typed.
Drag and drop does quote the field names.
If I type a double quote, then drag a field name, I get
If I type
If I start to type the table name (glorp), I have a choice of glob and glorp at "o" - not sure why no choice at "g" or "l" - perhaps you have a minimum length. No problem. If I down arrow to glorp and TAB, it completes. Given that it's a table name & there is no field of that name, I was slightly surprised not to have the "." added,.
If i add the ., I get Field1,Field2 offered. If I type F backspace F, no choice is offered. But if I add "ie", the choice is offered again. The behavior resets if I backspace over the ".', then add it again.
If I drag "glorp" to the select, it is highlighted in blue as if it is selected. But backspace doesn't clear the field. If I tab enough, the SQL tab gets the focus and backspace works. So it looks as though drag & drop doesn't set the focus to the target tab.
If I select (with control/click) glorp and either field, then drag and drop them, they appear quoted, but joined with comma, not dot. Perhaps I need the hidden option.
If I want quoted everything, might it work to put
Hope this helps - I'm out of time.
Yeah, that's me. I'm moving countries at the moment, and the nightly build server is a mac mini which needs fully setting up at the new location. It'll probably be a few days until I get around to it, as I'm putting time into higher priority (for me) stuff atm.
Sorry, @tlhackque , but I didn't remembered that the nightly builds weren't being generated. The commit is from 9 September, so it isn't in the version you've used. Some of the behaviour that you've described would still be present, though. I'll take a deeper look at your comments and answer them later.
It did so without option. After my commit it can be configured.
This will still happen, unless you configure drag and drop for not quoting the identifier.
I don't understand this. Indeed the drag puts the cursor at the left of the dropped text. This is the behaviour of QScintilla. It's strange, because other widgets from Qt or other toolkits set the cursor at the right of the dropped text. I don't like that either. I'll ask in the QScintilla list, but my last question didn't get a response
It happens when you single click an item in the completion menu. I think it should then apply the completion to that item, but it seems to break the use of the keyboard for completion. This is performed also by QScintilla.
Yes, there is a threshold of 3 characters to trigger completion.
There isn't any kind of parsing of the query while parsing, so it cannot be so intelligent to know that in that context a field is expected and not a table.
The completion of "child items" is immediate after typing
This is again the standard behaviour for QScintilla and other Qt widgets. The focus is kept in the source of the drag. For our use case it would indeed make more sense to change to the editor.
This is the version thing. I can report it here when the nightlies are back again.
I tried to provide QScintilla with quoted identifiers, but it was ignoring the quotes. This is one of my questions to the mailing list, but no answer for the moment.