创建静态变量代码段

时间:2017-01-17 23:51:03

标签: visual-studio-code

当我输入工作正常的$name时,我正在构建一个生成的代码段,但是当我按Tab键转到${2:description}时,它转到$this ..我的片段在下方,如何绕过$this并直接进入描述。也可以大写用户输入的任何输入吗?

见这里:

https://gyazo.com/3022073092b13db8a62d9d828c811599

 "Get/Set": {
    "prefix": "-yadda",
    "body": [
        "/**",
        "*Getter for $name",
        "*",
        "* @return $name ${2:description}",
        "*/",
        "public function get$name() {",
        "    return $$this->$name;",
        "}",

        "/**",
        "*Setter for $name",
        "*",
        "* @param [$name] ${2:description}",
        "*/",
        "public function set$name($$name) {",
        "   $$this->$name = $$name",

        "   return $$this;",
        "}"
    ],
    "description": "Generate Getters and Setters"
}

1 个答案:

答案 0 :(得分:0)

您似乎试图使用bind(interfaceType) .toInstance(newProxyInstance(loader, handler, interfaceType[, ...])); 转义$,而$$是正确的做法(记录为here)。

这对我有用:

\$