符合格式后,为什么我的vs代码段不起作用?

时间:2020-03-17 15:21:25

标签: visual-studio-code vscode-snippets

我正在尝试摘录以完成此操作

recipes.addShaped("name", output,
[
[input,input,input],
[input,input,input],
[input,input,input]
]);

我要使用的代码是这个

"Add a shaped": {
    "prefix": ["rec", "add"],
    "body": ["
recipes.addShaped("${1:name}", ${2:output},
[
[${3:input},${4:input},${5:input}],
[${6:input},${7:input},${8:input}],
[${9:input},${10:input},${11:input}]
]);

"],
    "description": "Add a shaped recipe."
  }

任何帮助将不胜感激。 丹

1 个答案:

答案 0 :(得分:0)

尝试一下:

"Add a shaped": {
  "prefix": ["rec", "add"],
  "body": [
    "recipes.addShaped(\"${1:name}\", ${2:output},",
    "[",
    "[${3:input},${4:input},${5:input}],",
    "[${6:input},${7:input},${8:input}],",
    "[${9:input},${10:input},${11:input}]",
    "]);"
  ],
  "description": "Add a shaped recipe."
},

正文的所有行都必须单独引用,并且一行中的qout必须转义。

并且结果将显示为与当前缩进齐平的左侧,而不必像您那样将主体放在最左侧。通常只需缩进代码段即可设置左点。在那里的任何缩进都会使结果缩进。