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

Remembering passwords in SQL Compare and SQL Data Compare

We’ve recently added a feature to automatically populate your SQL Server credentials when you’re using SQL Compare or SQL Data Compare. If you check the Remember credentials box, passwords will no...

Also in Product learning

SQL Clone Quick Tip: Offloading DBCC checks

If corruption creeps into a database, and from there into its backup chain, it can and will derail the best-laid Disaster Recovery plans. How, as a DBA, do you guard against this? The first line of de...

Also in SQL Prompt

How to record T-SQL execution times using a SQL Prompt snippet

A SQL Prompt snippet is a pre-defined block of code, which we can insert at the current cursor position, or around currently-selected SQL text, in an SSMS query pane. DBAs use them to store all their ...

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...