Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 使用用户定义的代码段覆盖VS代码段_Visual Studio Code - Fatal编程技术网

Visual studio code 使用用户定义的代码段覆盖VS代码段

Visual studio code 使用用户定义的代码段覆盖VS代码段,visual-studio-code,Visual Studio Code,我已经在VisualStudio代码中配置了以下类型脚本片段 "console.log": { "prefix": "cl", "body": [ "console.log();" ], "description": "console.log()" } 但是它不起作用,因为已经为cl(类)定义了一个代码段。我怎样才能用我的代码覆盖那个片段?我想使用cl,因为我有其他IDE也是以同样的方式配置的,我不

我已经在VisualStudio代码中配置了以下类型脚本片段

"console.log": {
        "prefix": "cl",
        "body": [
            "console.log();"
        ],
        "description": "console.log()"
    }

但是它不起作用,因为已经为
cl
(类)定义了一个代码段。我怎样才能用我的代码覆盖那个片段?我想使用
cl
,因为我有其他IDE也是以同样的方式配置的,我不想改变我的惯例。

当您键入
cl
时,会显示cl代码段所有可能扩展的列表,您的代码段可能位于列表的底部。为了访问列表顶部的代码段,您可以将以下内容添加到
设置.json

// Place your settings in this file to overwrite the default settings
{
    "typescript.useCodeSnippetsOnMethodSuggest": true,
    "editor.snippetSuggestions": "top",
    "editor.tabCompletion": true
}
这里请注意
编辑器.snippet建议
。这是定义自动完成列表排序的设置,当您键入代码段的缩写时,该列表将显示。默认情况下,它是
bottom
,这就是您的代码段出现在列表末尾的原因