vscode配置Configure User Snippets 不生效

正常Ctrl+shift+p打开"设置",Configure User Snippets -> python.json

复制代码
{
    // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
    // same ids are connected.
    // Example:
    // "Print to console": {
    //     "prefix": "log",
    //     "body": [
    //         "console.log('$1');",
    //         "$2"
    //     ],
    //     "description": "Log output to console"
    // }
    // 自己定义的snippet
    "Print2": {
        "prefix": "print2",
        "body": [
            "print('$1')",
            "print('-' * 30)",
            "print($1)",
            "print('-' * 30)"
        ],
        "description": "Log output to console"
    },
    "Print@": {
        "prefix": "print@",
        "body": [
            "print('@' * 30)"
        ],
        "description": "Log output to console"
    }
}
复制代码

 

配置完保存就行了,但是我的死活不生效,查了半天终于找到原因。

解决方法:

以json文件的形式打开"设置",设置->Open Settings(JSON),

"editor.suggest.showSnippets"改成true,否则怎么设置都不会生效

{
    "editor.suggest.showSnippets": true,
}

 

 
posted @   豆浆D  阅读(1057)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
历史上的今天:
2021-07-14 python的re(正则表达式)
2021-07-14 正则表达式基础
点击右上角即可分享
微信分享提示