litecli icon indicating copy to clipboard operation
litecli copied to clipboard

Enable completion suggestion after SELECT based on the tables

Open FreddieOliveira opened this issue 4 years ago • 2 comments

If you open the chinook db and run the following command

select artists.name,albums.title from artists,albums where artists.`ArtistId` = albums.`ArtistId`

litecli will only suggest completions for artist. and albums. after the where, but not after the select. That means, the artists.name,albums.title have to be typed characters by character without completion help.

FreddieOliveira avatar Aug 22 '20 21:08 FreddieOliveira

Thanks for the feedback. There is a simple workaround for this.

First, you type something like this:

select * from from artists, albums <cursor>

Then, you go back to delete the * and start typing the fields that you are interested:

select artists.<cursor> from from artists, albums

Now you should get the auto suggestions.

Basically, you have to tell the CLI which tables you are going to use.FROM is a good hint.

We probably could extract the tables from a partial query like below:

select artists.

You could say that the part before . is the table name, but then we have to deal with below use case:

select `artists.

zzl0 avatar Aug 26 '20 04:08 zzl0

Cool, the workaround worked, but I still think suggesting tables name for completion after typing select would be very handy.

FreddieOliveira avatar Aug 26 '20 22:08 FreddieOliveira