4 September 2017
4 September 2017

SQL Prompt Tip: how to control when the suggestion box pops up

Guest post

This is a guest post from Phil Factor. Phil Factor (real name withheld to protect the guilty), aka Database Mole, has 30 years of experience with database-intensive applications.

Despite having once been shouted at by a furious Bill Gates at an exhibition in the early 1980s, he has remained resolutely anonymous throughout his career.

He is a regular contributor to Simple Talk and SQLServerCentral.

By default, SQL Prompt shows code auto-completion suggestions automatically, and continuously. In practice, when writing code, this means that the suggestion box pops up whenever SQL Prompt thinks it can make a useful suggestion, which is at virtually every keystroke.

That isn’t the way that many of us want it to work. Sometimes, as programmers, we need it to be a little less intrusive, especially when working through more intricate coding problems that required careful thought.

One option is to switch auto-complete suggestions on and off, via Ctrl+Shift+P, but we don’t recommend you do this regularly, because each time it triggers Prompt to query the database to refresh its database metadata. The better alternative is to leave suggestions enabled all the time, but control their behavior. You have two choices: either stop them displaying so frequently, or stop them displaying unless you request them, using Ctrl+Space.

Here’s how to do it: open the SQL Prompt menu, click Options to get the Options window and then go to the Suggestions > Behaviour pane.

Less frequent auto-suggestions

By default, Show code suggestions is enabled (if it’s not, enable it), and Automatically show suggestions… is also enabled and set to between 0 and 70 milliseconds (depending on which version of Prompt you have installed). Leaving both options enabled, simply increase the automatic suggestion frequency to, say, 5000 ms, or whatever you feel will work best for you.

Control frequency of Prompt auto-complete suggestions

Hit OK to save your setting.

Now the suggestion box will pop up only after a 5-sec delay. Don’t forget that you can still get suggestions ‘on demand’ just by pressing Ctrl and then hitting the space bar (Ctrl+Space).

Suggestions on demand only

If you want Prompt to show suggestions only ‘on demand’, simply uncheck the Automatically show suggestions…box while leaving Show code suggestions box enabled.

Prompt auto-complete suggestions on demand only

Hit OK to save your setting. Now you’ll never see auto-complete suggestions unless you hit (Ctrl+Space).

Tools in this post

SQL Prompt

Write, format, and refactor SQL effortlessly in SQL Server Management Studio and Visual Studio.

Find out more

Guest post

This is a guest post from Phil Factor. Phil Factor (real name withheld to protect the guilty), aka Database Mole, has 30 years of experience with database-intensive applications.

Despite having once been shouted at by a furious Bill Gates at an exhibition in the early 1980s, he has remained resolutely anonymous throughout his career.

He is a regular contributor to Simple Talk and SQLServerCentral.

Share this post.

Share on FacebookShare on Google+Share on LinkedInTweet about this on Twitter

Related posts

Also in Hub

What is SQL Change Automation?

It is easy to deliver a small SQL Server test database without extra software tools, but once you edge into the real world you will soon need a consistent and repeatable way of automating as much as p...

Also in Product learning

Troubleshooting Blocking in SQL Server using SQL Monitor

A call comes in to the DBA from Help Desk. There is an urgent problem with a reporting application; unhappy users say that their screens are "frozen", and not because of an overactive A/C vent. Some h...

Also in SQL Prompt

SQL Prompt Hidden Gems: The SSMS Results Pane

Within SSMS, when executing a query, we can view the query results in a grid, or tabular, format (Ctrl-D), as plain text (Ctrl-T), or we can write them to a plain-text reporting (.rpt) file using Ctrl...

Also about Intellisense

SQL Prompt Hidden Gem: Auto-fill the GROUP BY clause

"Have you seen this new feature that auto-fills the GROUP BY with non-aggregated columns!" exclaimed my co-worker, soon after she had installed a new version of SSMS. I hadn't, but I was intrigued. I ...

Also about SQL Prompt

Avoid use of the MONEY and SMALLMONEY datatypes

The MONEY data type confuses the storage of data values with their display, though its name clearly suggests the sort of data it holds. It is proprietary to SQL Server and allows you to specify moneta...