Visual Studio 打字稿的代码扩展开发问题
Visual Studio Code extension development problem with typescript
正如您在上面看到的,构建过程永远不会完成,也不会出现扩展主机 window。
当所有扩展全部禁用时也存在该问题
但是用javascript创建项目时不存在这个问题(这个问题只存在于typescript)
我遵循的步骤来自this tutorial
我还尝试了 github 中的 hello world 示例。
但是 none 他们的工作。
编辑:
我尝试通过 code --extensionDevelopmentPath="path/to/my/project"
手动打开扩展开发主机 window 并且成功了。
- 我认为问题出在 vscode 的某些配置上
可能的修复:我应该检查 npm: watch
等配置。但我不知道它们在哪里,我应该用它们做什么??
有什么想法吗?
编辑 2:
task.json
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
- 然后我注意到,如果我在
launch.json
文件中注释掉 "preLaunchTask": "${defaultBuildTask}"
,问题就解决了。
我终于抓住了问题。那是因为我的系统的语言环境设置为 Persian
打字稿问题匹配器无法识别(波斯数字)。
通过将系统区域设置为英语,问题解决了,现在一切正常。
正如您在上面看到的,构建过程永远不会完成,也不会出现扩展主机 window。
当所有扩展全部禁用时也存在该问题
但是用javascript创建项目时不存在这个问题(这个问题只存在于typescript)
我遵循的步骤来自this tutorial 我还尝试了 github 中的 hello world 示例。 但是 none 他们的工作。
编辑:
我尝试通过 code --extensionDevelopmentPath="path/to/my/project"
手动打开扩展开发主机 window 并且成功了。
- 我认为问题出在 vscode 的某些配置上
可能的修复:我应该检查 npm: watch
等配置。但我不知道它们在哪里,我应该用它们做什么??
有什么想法吗?
编辑 2:
task.json
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
- 然后我注意到,如果我在
launch.json
文件中注释掉"preLaunchTask": "${defaultBuildTask}"
,问题就解决了。
我终于抓住了问题。那是因为我的系统的语言环境设置为 Persian
打字稿问题匹配器无法识别(波斯数字)。
通过将系统区域设置为英语,问题解决了,现在一切正常。