VSCode PHP代码段在我打开文件时起作用,但是在我打开文件夹时不起作用

时间:2019-12-17 12:36:22

标签: visual-studio-code

我的php.json仅包含一个代码段:

{
    // Place your snippets for php 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"
    // }

    "Exit": {
        "prefix": "xxx",
        "body": "exit(__FILE__ . ': ' . __LINE__);",
        "description": "Simple exit"
    }
}

(我知道这不是有效的JSON,因为JSON不支持注释,但这是VSCode给我的。)

如果我打开一个单独的PHP文件,则可以正常工作,并且 x x x Tab 正确替换为exit(__FILE__ . ': ' . __LINE__);。但是,如果我打开一个文件夹,然后在该文件夹中编辑PHP文件,则此代码段无效。这是VSCode中的错误,还是我做错了什么?

我正在Ubuntu 18.04上运行,并且是VSCode的新手(因为在升级Ubuntu时Netbeans断开了,但这是a separate issue)。

0 个答案:

没有答案