mtxr / SublimeText-SQLTools

SQLTools for Sublime Text 3
https://code.mteixeira.dev/SublimeText-SQLTools/
GNU General Public License v3.0
177 stars 40 forks source link

Column name completion not working #67

Closed Ex8ey closed 7 years ago

Ex8ey commented 7 years ago

I'm using MySQL, OS X, freshly installed. Auto complete works perfectly for table names, but never for column names. Any ideas why that is?

p.s. Thanks so much for this package. It makes querying fun. As I learn more about sql, I hope to contribute later.

mtxr commented 7 years ago

Have you tried to setup changing auto_complete_triggers? http://code.mteixeira.me/SQLTools/#auto-complete

Ex8ey commented 7 years ago

Yes, I added that code segment per your instructions. '.' does nothing. I tried to replicate exactly what you were doing in your .gif files. The only consistency is that tables always show up and columns never show up.

I'm pretty new to sql in general, so if there are modifications which I should make to auto_complete_triggers, please let me know.

AALMA commented 7 years ago

I am having the same experience. It autocompleted table names fine but no columns. Even followed the suggestion of changing the autocomplete trigger setting, a just tried manually bringing the autocomplete list up and no columns. Anywhere I can look to troubleshoot what may be going on.

Other than that this has been a really helpful package for me. I'm working on migrating my application from MSSQL to MariaDB and for most of what I used to do with SSMS, this package allows me to do it in Sublime much faster.

tkopets commented 7 years ago

I will take a look into completions problem. Nice to hear about your use case, as I do a lot of PostgreSQL related coding myself using this package, including writing lots of DDL, queries, functions.

tkopets commented 7 years ago

@AALMA Can you please share how this plugin makes your coding more productive/easier? What is your usual workflow with SQLTools?

AALMA commented 7 years ago

It helps me be more productive because I can work a lot faster in sublime than in any MySQL client I've found yet. Really, if it would auto-complete column names, show execution time, and provide some interface feedback that a query is running it would be all I need for my work. I'm happy to help in any way I can. I'm not sure if there are any logs I could provide to help track down this issue, if so let me know.

tkopets commented 7 years ago

Thanks for your feedback @AALMA!

On execution time: If you want to see how long the query took you have two options here (modify your SQLTools settings file):

Note: both options have a side-effect of outputting the query being executed as well in output. I think it would make sense to create a new setting in SQLTools called show_query_time, so you will be able to configure if you want to see the executed query and time it took to execute separately.

On query progress: This is a great idea! I'll try to see if it is possible to output query progress in Sublime status bar.

On completions: I know having these completions in place is a huge productivity boost for writing SQL. I'm currently working on getting a bit better completions with SQLTools, hopefully, those will be smart enough to show completions for table aliases as well. Right now I have a working prototype in a separate branch https://github.com/mtxr/SQLTools/tree/smart_completions However, there is still some code polishing to be done before this can be considered to be merged. I'll try to post a little demo later today, so you can get a feel how these completions work.

tkopets commented 7 years ago

Here is a concept for new completions.

Table and columns completions: table and columns

Completions relevant to current SQL statement shown first: relevant

Completions of specific tables columns: cols

Completions of aliases and table's columns related to specific alias: alias

Ex8ey commented 7 years ago

Man, it looks really great! Your work is greatly appreciated.

tkopets commented 7 years ago

Thanks @cwunstel !

Here is one last bit I wanted to finish in regards to completions functionality - completion of join conditions: join condition completion

All these new completions will be ready soon and it would be great if you guys can try and test them a bit to see if everything works fine. I will make these completions optional (a switch in settings) in next release so everybody can try them.

Ex8ey commented 7 years ago

Gladly. Let us know and I'll test it up & down.

tkopets commented 7 years ago

New completions should be available in the new release, let me know if you find any problems using it.

NOTE: It is highly recommended that you review your SQLTools settings file User/SQLTools.sublime-settings and leave only those settings that you altered specifically to your needs and remove all other settings. This way the updated queries listed in default settings file would be used for new smarter completions to work correctly.

tkopets commented 7 years ago

@cwunstel @AALMA There are minor fixes to completion code in new release v0.8.3. Do they work for you?

AALMA commented 7 years ago

@tkopets Yes, the completions seem to be working well for me now.

Thanks!

Ex8ey commented 7 years ago

Working beautifully, thanks! Just a note for others: Initially it was autocompleting for me but in a very strange way. For example, the completion for the attribute 'FirstName', which was in the table 'Employee', was 'FirstNameEmployee', a simple concatenation. Deleting user prefs did nothing; Reinstalling, however, worked perfectly.

tkopets commented 7 years ago

Not sure, but maybe a restart of Sublime Text would be enough (so plugin code reloads completely)? Or this issue lasted even after restarts?

Ex8ey commented 7 years ago

I certainly did attempt restart.

Also, just now I closed Sublime and replaced the fresh/new/blank pref file with my old one (which at this point is only composed only of '{' and '}') and I got the same problem. So perhaps this was a unique issue of a corrupted pref file. It now seems that logic dictates that reinstalling was not necessary.

On May 12, 2017, at 4:57 PM, Taras Kopets notifications@github.com wrote:

Not sure, but maybe a restart of Sublime Text would be enough (so plugin code reloads completely)? Or this issue lasted even after restarts?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.