4

I'm trying to use the Snippets functionality in SQL Server.

I'm testing out adding new snippets to SQL Server 2014 following the instruction here.

Everything works fine except that after I added the snippet, it doesn't show up in the IntelliSense. Even more, I realized that not all build-in Snippets are showing up.

I wonder if anyone else has the same experience, and knows how to resolve this?

This is a list of build-in snippets under Function

build-in

And this is what I see from IntelliSense (3 of them are missing)

missing snippet

Tanner
  • 22,205
  • 9
  • 65
  • 83
xbb
  • 2,073
  • 1
  • 19
  • 34
  • can you share one of your snippet files please as it contains a bunch of info about how the snippet can be used. – Tanner Apr 17 '15 at 14:23
  • @Tanner the only one I added is the sample template that you can find in my original post. Or link here: https://msdn.microsoft.com/en-us/library/gg492130.aspx – xbb Apr 17 '15 at 14:28

1 Answers1

8

The issue is likely in the definition of the snippets.

If you inspect your snippets you should see a section like:

<SnippetTypes>
    <SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>

Or

<SnippetTypes>
    <SnippetType>Expansion</SnippetType>
</SnippetTypes>

These indicate where the snippet can and will be used from.

In a query window you have 2 options when you right click:

  • Insert snippet
  • Surround with

Which give you the different options as you can see here:

enter image description here

enter image description here

This explains why you're not seeing the missing options when you try to insert a snippet.

Tanner
  • 22,205
  • 9
  • 65
  • 83