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

How to Customize Schema Comparisons using Auto Map in SQL Compare

It's a tedious task to have to compare two versions of a SQL script, side by side, for example to find differences between the version of the script on Production, and the one on the Test system. As a...

Also in Product learning

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 in SQL Prompt

A day in the life of a developer with SQL Prompt

I've a a busy day ahead of me, working on a new reporting query, plus reviewing some initial database designs for the team. We've done the morning stand-up meeting, I've had my morning coffee, SQL Ser...

Also about Intellisense

The SQL Prompt Functionality Finder

You've got SQL Prompt, but are you aware of all the things it can do and how to get Prompt to do it? In this article, Phil Factor provides a handy table to make it obvious.

As soon as you open SQL Pr...

Also about SQL Prompt

Templates and Snippets in SSMS and SQL Prompt

In SSMS, we have access to templates that provide building blocks for creating various types of query, common routines to create various schema objects, or to do common DBA tasks such as running backu...