Search code examples
c++visual-studio-codecode-snippetstab-completion

VSCode User Snippet not working inside other snippet


I created some VSCode User Snippet, but it not working inside other snippet.

This is newest version of VSCode, 1.36.

If I have this snippet,

    "tmp": {
        "prefix": "tmp",
        "body": [
            "#include <bits/stdc++.h>",
            "using namespace std;",
            "",
            "int main()",
            "{",
            "    ${1:int} ans;",
            "    ${2:/* code */}",
            "    return 0;",
            "}"
        ],
        "description": "template"
    },

and trying this snippet inside $2 above,

    "cin1": {
        "prefix": "cin1",
        "body": [
            "int a;",
            "cin >> a;"
        ],
        "description": "template"
    },

it never works, and show nothing in completion.

I'd like to show completion inside snippet. Any helps are appreciated.


Solution

  • Set this to false (as in deselect the checkbox in the settings panel) :

    "editor.suggest.snippetsPreventQuickSuggestions": false
    

    The default is true and will prevent your inside snippet from working as a snippet.