Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code user snippets not working

I've enabled the default "log" snippet in VS Code. I also added another snippet. Neither show up when I type their prefixes. I have set editor.tabCompletion to true.

Any idea why these don't work?

like image 431
4thSpace Avatar asked Jun 02 '17 04:06

4thSpace


People also ask

Why is VS Code snippets not working?

This fixed the problem for me: remove and then re-add all code snippet folders with the code snippet manager. Tools->Import and Export settings->Reset all settings. Chose reset and over write the existing settings options!

How do I enable snippet code in Visual Studio?

For example, in Visual Basic there's a code snippet that inserts a property. To insert the snippet, choose Snippet > Insert Snippet from the right-click or context menu in a Visual Basic code file. Then, choose Code Patterns > Properties, Procedures, Events > Define a Property.

How do I set up code snippets?

With a code file open in the editor, choose Snippets > Insert Snippet from the right-click menu, then My Code Snippets. You should see a snippet named Square Root. Double-click it. The snippet code is inserted in the code file.


1 Answers

There are a couple of ways you can fix this problem. The problem is Intellisense is getting in the way or default putting your snippets at the bottom of the list.

First I played with the suggestion delay, but then I settled on having Intellisense put my snippets in the top of the list of suggestions with the snippetSuggestions user preference:

{   "editor.tabCompletion": true,   "editor.snippetSuggestions": "top" } 
like image 107
Sia Avatar answered Sep 28 '22 10:09

Sia