VS代码扩展" HelloWorld"打字稿中的样本不起作用

时间:2018-06-07 19:16:10

标签: typescript visual-studio-code vscode-extensions

我尝试创建VS代码扩展并按照文档here中提供的步骤进行操作

我设置" helloworld"打字稿中的项目但是当我按下" F5"时,什么也没发生。我看到,打字稿文件符合JS,但项目没有打开VS代码的新实例,并且未启用调试模式" F5"。

有什么建议吗?。

launch.json文件

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Extension",
        "type": "extensionHost",
        "request": "launch",
        "runtimeExecutable": "${execPath}",
        "args": [
            "--extensionDevelopmentPath=${workspaceFolder}"
        ],
        "outFiles": [
            "${workspaceFolder}/out/**/*.js"
        ],
        "preLaunchTask": "npm: watch"
    },
    {
        "name": "Extension Tests",
        "type": "extensionHost",
        "request": "launch",
        "runtimeExecutable": "${execPath}",
        "args": [
            "--extensionDevelopmentPath=${workspaceFolder}",
            "--extensionTestsPath=${workspaceFolder}/out/test"
        ],
        "outFiles": [
            "${workspaceFolder}/out/test/**/*.js"
        ],
        "preLaunchTask": "npm: watch"
    },

]

}

我遵循的步骤与VS代码文档中提到的相同

  1. npm install -g yo generator-code
  2. 你的代码
  3. 启动VS Code,
  4. 选择文件>打开文件夹并选择您生成的文件夹。
  5. 按F5或单击“调试”图标,然后单击“开始”。

    对我来说,步骤#5不起作用,没有做任何事情

2 个答案:

答案 0 :(得分:2)

您的启动文件看起来不像yo 2.0.2生成的文件。 那个生成启动文件版本0.1.0而不是像你的0.2.0。

目前你应该有yo 2.0.2和vscode 1.24.0。请验证。

我从头开始为vscode创建了一个typescript扩展,并得到了这个:

{
  "version": "0.1.0",
  "configurations": [
    {
        "name": "Launch Extension",
        "type": "extensionHost",
        "request": "launch",
        "runtimeExecutable": "${execPath}",
        "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
        "stopOnEntry": false,
        "sourceMaps": true,
        "outDir": "${workspaceRoot}/out/src",
        "preLaunchTask": "npm"
    },
    {
        "name": "Launch Tests",
        "type": "extensionHost",
        "request": "launch",
        "runtimeExecutable": "${execPath}",
        "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
        "stopOnEntry": false,
        "sourceMaps": true,
        "outDir": "${workspaceRoot}/out/test",
        "preLaunchTask": "npm"
    }
  ]
}

答案 1 :(得分:0)

对于我来说,我只是重新安装了相同版本的节点,问题已解决。

$ export PYTHON_BIN_PATH=/usr/bin/python
$ echo $PYTHON_BIN_PATH
/usr/bin/python

参考:Error: Cannot find module '../lib/utils/unsupported.js' while using Ionic