New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: format SQL code-completetion commands as UPPER CASE #1238

Closed
SilvioGrosso opened this Issue Nov 20, 2017 · 9 comments

Comments

Projects
None yet
5 participants
@SilvioGrosso
Copy link

SilvioGrosso commented Nov 20, 2017

Hello everyone,

Just tested today's build on Windows 10 - 64 bit (downloaded the x64.exe version).

Currently, whenever you write your code into the Execute SQL tab there is no way (or shortcut) to automatically format it (UPPER CASE, new line, indentations and so on).
Most of all, whenever you write your code in the Execute SQL window and you press enter all commands are always proposed (forced) as lower case (create, select, from, where, like instead of CREATE, SELECT, FROM, WHERE, LIKE etc).
This style formatting improvement is possible in many GUIs applications such as the freeware SqliteStudio [1] or by dint of web applications [2].

What about adding an option, in the "Preferences..." window, as regards the code-completion feature, in Sqlite Browser, to have them proposed as UPPER CASE instead ? :-)

For instance , you write your SQL code to create a new table.
Whenever you press enter on your keyboard to apply the create command this is formatted as CREATE instead of create as it is now (same things for the other commands: from, where, like etc).

Thanks a lot in advance for reading this very long message :-)

[1] https://www.dropbox.com/s/doxq0yfquwa2xwl/SQLITESTUDIO_FORMAT_SQL_CODE.mp4?dl=0
[2] https://sqlformat.org/

@justinclift

This comment has been minimized.

Copy link
Member

justinclift commented Nov 20, 2017

Sounds like a good suggestion to me. 😄

@mgrojo

This comment has been minimized.

Copy link
Contributor

mgrojo commented Jan 6, 2018

I wonder what should be the default value for the new preference setting ("Keywords in UPPER CASE"). Should it be false to honour the current behaviour? Or should it be true because the preferred style for SQL is usually keywords in upper case?

@chrisjlocke

This comment has been minimized.

Copy link
Contributor

chrisjlocke commented Jan 6, 2018

As it has no effect on anything but output for the user, I suggest it should be on by default ... by turning it on, it's not going to break anything.
The more DB4S adheres to the standard, is a good thing.

@justinclift

This comment has been minimized.

Copy link
Member

justinclift commented Jan 6, 2018

If it's easy, just turn it on. If someone complains (not expecting so, but could be wrong), we can then think about changing it. 😉

mgrojo added a commit that referenced this issue Jan 6, 2018

Automatic completion of SQL keywords in upper case
Added a new setting for completing the SQL keywords in upper case (default
being true).

Scintilla setAutoCompletionCaseSensitivity is set to false. Otherwise the
completion is only done in lowercase when both case versions are added,
or if only upper case version is added, writing lower case letters does
not use the upper case version of the word in the completion list. This
change doesn't have apparently any downside, since SQL is actually case
insensitive.

Consequently the list of keywords is only added in one of the two letter
case versions, depending on the new setting value.

The new preference check-box is only enabled when the auto-complete
check-box is checked.

See issues #1238 and #1287.
@mgrojo

This comment has been minimized.

Copy link
Contributor

mgrojo commented Jan 6, 2018

@SilvioGrosso @fulldecent @lausek I've just implemented the completion of SQL keywords as upper case. If you want to give it a try, it will be available in our next nightly build: https://nightlies.sqlitebrowser.org/latest/

@fulldecent

This comment has been minimized.

Copy link

fulldecent commented Jan 7, 2018

Looks great, thank you!

@chrisjlocke

This comment has been minimized.

Copy link
Contributor

chrisjlocke commented Jan 7, 2018

Works well - thanks @mgrojo.

Semi linked to this, but can the auto complete have more than one word, or is it limited to just words? If you type LEFT, it would be handy if it auto completed to LEFT JOIN rather than just LEFT (same for right)... maybe even suggest SELECT * FROM in addition to just SELECT too.... but I'm scampering into a different issue now....... ;) Maybe just have a 'suggestions.txt' in the application folder the user could edit. Oh, I'll shut up now... ;)

@SilvioGrosso

This comment has been minimized.

Copy link
Author

SilvioGrosso commented Jan 7, 2018

Just tested on Windows 10 (64 bit) and everything is fine.
Now SQL code is easier to read...

Thanks a lot indeed ! :-)

@justinclift

This comment has been minimized.

Copy link
Member

justinclift commented Jan 7, 2018

@chrisjlocke If you're still interested in that, make another issue for the suggestion, as I'm closing this now since it's done. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment