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

Misuse of the scalar user-defined function as a constant (PE017)

Do not use a scalar user-defined function (UDF) in a JOIN condition, WHERE search condition, or in a SELECT list, unless the function is schema-bound. Scalar UDFs are often used without a parameter to...

Also in Product learning

Customizing the SQL Prompt built-in snippets: a better 'ata' snippet

Snippets are a great feature of SQL Prompt. They save coding time, and introduce standards and consistency to the way you build code modules. They have multiple replacement points (placeholders) for p...

Also in SQL Prompt

Avoid T-SQL Technical Debt using SQL Prompt Code Analysis

SQL Prompt's Code Analysis feature helps you discover code issues and hidden pitfalls during code development, as you type. It also provides tips for improving your code, and includes links to documen...

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

How to Test SQL Server Functions and Procedures using SQL Prompt

When writing functions or procedures, a common chore is to devise and implement the tests that ensure that the routine always works as expected. The best way to do this is to define the tests in a bat...