Bug: CTRL+Space suggestion corrupting keywords
AndrewN_SZ
Posts: 2 New member
in SQL Prompt
If I type a keyword but don't select it from the suggestions list and later want to go back and correct the case to upper I place my cursor somewhere within the keyword and key CTRL+Space.
This brings up the suggestions list and, when selecting the correct entry the keyword get corrupted.
My example is, if I type the following -
select * FROM table
then put my cursor somewhere on the word select (say between e & l), press CTRL+Space and take the first suggestion, what I end up with is the following -
SELECTlect * FROM table
The characters to the left or the cursor are overwritten, but to the right are retained.
I am using version 10.13.12.1701 in SSMS version 15.0.18424.0
This brings up the suggestions list and, when selecting the correct entry the keyword get corrupted.
My example is, if I type the following -
select * FROM table
then put my cursor somewhere on the word select (say between e & l), press CTRL+Space and take the first suggestion, what I end up with is the following -
SELECTlect * FROM table
The characters to the left or the cursor are overwritten, but to the right are retained.
I am using version 10.13.12.1701 in SSMS version 15.0.18424.0
Tagged:
Answers
Thank you for reaching out on the Redgate forums, I can see the behaviour here and believe it to be working as anticipated, but perhaps not as expected.
CTRL+SPACE is opening up the suggestions pop-up which reads text to the left of the cursor to try and complete a word you are typing.
Wherever you have selected within your existing word when you initiate this pop-up box it will then attempt to fill the rest of the word after your cursor.
This is evident in your example - selecting between the e & l in select would have the expected output of replacing the se from your text with uppercase SE and then adding LECT after the cursor, leaving you with SELECTlect
You are able to apply casing to your code either through the SQL Prompt menu > Apply Casing Options
or through keyboard shortcut CTRL+B, CTRL+U
This can be used on a selection of text to only case it; or on the entire script at once.
Thanks for the info. I was comparing the behaviour with the same functionality in Visual Studio.
When keying CTRL+SPACE, VS seems to replace the keyword up to the next space found in the current line of code.
I know I shouldn't really compare different products but, using CTRL+SPACE a lot in VS it catches me out not having the same outcome in SQL Prompt.
Just an observation.