azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

Intellisense: Auto-Complete with [space] bar

Open barryseymour opened this issue 7 years ago • 17 comments

  • SQL Operations Studio Version: 0.26.7

Recommend: User should have the option to designate SPACEBAR as an Intellisense trigger. Once a list of suggestions appears, SPACEBAR should automatically insert the currently selected entry in the list.

Steps to Reproduce:

  • Type 'select * from '- SELECT and FROM keywords are not capitalized. No list of tables is presented.
  • Type 'SELECT * FROM [tablename] WHERE ' - no field names are listed

Desired Functionality:

  • Type 'Select', press SPACEBAR: Intellisense detects and capitalizes the SELECT keyword.
  • Type ' * from ': Intellisense detects and capitalizes the FROM keyword, then presents a list of selectable items (Tables, Views, Functions, Synonyms)
  • Start typing an item name: Intellisense lists all matching items, narrowing the list as you type, selecting the first match as you type.
  • Press SPACEBAR: If a table name is selected in the list, insert it with proper casing. Add a space.

I know this will probably be very tricky from a coding standpoint, but I just want to be able to hit the spacebar to get my autocompleted code item.

Thanks!

Barry Seymour

barryseymour avatar Mar 02 '18 21:03 barryseymour

I think this would need to be configurable since some dev orgs have different coding standards and may not want capitalization by default.

AdamWilbur avatar Mar 08 '18 20:03 AdamWilbur

It's not the capitalization of the keyword (although I want that option too) - it's triggering an IntelliSense selection when pressing [spacebar]. Right now, If I type...

select * from tablename where fieldname = value

...nothing gets capitalized. But if I type select [tab] after a keyword, the word is capitalized. Thus I'd have to type

select[tab][space]* from [tab][space] tablename [tab][space] where [tab][space] fieldname[tab][space] = value.

Lots of extra, non-intuitive keystrokes, slowing my typing / thinking.

barryseymour avatar Mar 08 '18 21:03 barryseymour

Ah, I misunderstood, I have the same problem. Thanks for clarifying

AdamWilbur avatar Mar 08 '18 21:03 AdamWilbur

This sounds like a core Monaco editor suggestion that would definitely be an upstream issue. @kburtram

anthonydresser avatar Mar 29 '18 19:03 anthonydresser

What do you mean 'an upstream issue?' Do you refer to another software package that this program is based on? (Visual Studio Code?) If so, what should my course of action be?

barryseymour avatar Mar 29 '18 19:03 barryseymour

Most of the core editor code comes directly from vscode, we modify it as little as possible in order to keep getting bug fixes from their work. Upstream means we believe it is probably a bug in their code and it would require us modifying their code in order to fix. I tagged @kburtram as I'm not sure what our planned path going forward is on these types of issues; whether the user should create a bug in the vscode repo or we should do it on behave of the user.

If you can verify this behavior exists on vscode as well, you can submit a bug on their repo https://github.com/Microsoft/vscode and we will pick up their fixes during our periodic syncs.

anthonydresser avatar Mar 29 '18 19:03 anthonydresser

I've installed VS Code and am installing the mssql extension. Did not know this stuff existed. Looking forward to trying it out!

barryseymour avatar Mar 29 '18 21:03 barryseymour

It happens in VSCode as well when I install the mssql extension. Not sure if this should be considered a bug in the upstream product or the mssql extension.

barryseymour avatar Mar 29 '18 21:03 barryseymour

@kburtram would have more context here as he built the intellisense part of both sqlops and the extension. I'm not sure if this problem is because our intellisense engine isn't correctly sending intellisense back to vscode, or if vscode is not asking for intellisense.

anthonydresser avatar Mar 29 '18 23:03 anthonydresser

@kburtram would a space bar / whitespace trigger for intellisense be doable?

barryseymour avatar Mar 29 '18 23:03 barryseymour

@barryseymour the auto-completion behavior is baked into the VS Code editor platform source code that we fork. In general we defer to VS Code's decisions for this type of behavior since they are the experts in the editor space.

Since a change like this would require modifying the underlying platform code we'd prefer to see this modification made upstream and we could pick it up. I'll leave it on the backlog so we can gauge community interest.

kburtram avatar Apr 12 '18 21:04 kburtram

Very much +1 for this behaviour as this would mimic the years of red-gate muscle memory I've built up in SSMS

MartinAnthonyBooker avatar Nov 06 '18 10:11 MartinAnthonyBooker

Well they did this and it wasn't a good idea. When trying to type "NOT EXISTS" and press Space after NOT it auto completes to "Notify", which is a field in the table. Best to keep well enough alone in this case and press tab. The other issue is happens when correcting some's not capitalizing properly in a script, space auto-corrects it unless i hit escape.

Netislander avatar Nov 15 '18 15:11 Netislander

Well, exclude "not", then, as a common word.

Again, the prospect of typing...

select[tab][space]* from [tab][space] tablename [tab][space] where [tab][space] fieldname[tab][space] = value.

...is just too onerous. SSMS handles this, so does dbForge SQL Complete. This should be solveable, IMHO.

barryseymour avatar Nov 15 '18 16:11 barryseymour

Well, exclude "not", then, as a common word.

Again, the prospect of typing...

select[tab][space]* from [tab][space] tablename [tab][space] where [tab][space] fieldname[tab][space] = value.

...is just too onerous. SSMS handles this, so does dbForge SQL Complete. This should be solveable, IMHO.

I totally agree with you. I use dbForge SQL Complete and would love to have same behaviour on ADS. I believe it's doable

nosayabadonnie avatar Aug 15 '22 08:08 nosayabadonnie

Again, the prospect of typing...

select[tab][space]* from [tab][space] tablename [tab][space] where [tab][space] fieldname[tab][space] = value.

...is just too onerous.

Then... don't? Completing keywords and identifiers "intelligently" is the whole reason for using Intellisense. If you want "proper" casing and you're typing out the keywords anyway, CapsLock is a thing.

criptych avatar Aug 29 '22 12:08 criptych

Again, the prospect of typing... select[tab][space]* from [tab][space] tablename [tab][space] where [tab][space] fieldname[tab][space] = value. ...is just too onerous.

Then... don't? Completing keywords and identifiers "intelligently" is the whole reason for using Intellisense. If you want "proper" casing and you're typing out the keywords anyway, CapsLock is a thing.

Like I said, other platforms support this. If [tab] can trigger a case correction, why can't [spacebar]? The example of NOT was used above - what happens if you type 'NOT' and press tab? Sure, CapsLock is a thing, but turning that on and off all the time is not a solution either.

I want SQL keywords to be UPPER CASE. Variables and object names should match the case of their definitions. I don't think it's too much to ask.

barryseymour avatar Aug 29 '22 23:08 barryseymour