VSCode 扩展:命令 'Hello World' 导致错误(未找到命令 'vscode-err-reproduce.helloWorld')
VSCode Extension: Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found)
问题描述:
我尝试使用文档中提供的示例扩展(哟代码)创建 VS 代码扩展。在创建它时,我选择了“打字稿”作为扩展类型。
当我尝试 运行 扩展时,我收到一条错误消息。
Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found)
Activating extension 'undefined_publisher.vscode-err-reproduce' failed: Cannot find module
'/oct/vscode-extn-ts-error/vscode-err-reproduce/out/extension.js' Require stack: - /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js.
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"outDir": "out",
"lib": [
"ES2020"
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": [
"node_modules",
".vscode-test"
]
}
错误是由于编译未 运行 或未能 运行 启动扩展。因此 .js 文件不会在 /out/* 目录
上创建
- 我通过从根目录手动 运行ning tsc --watch 解决了这个问题。
- 我以为,默认情况下启动扩展会触发编译,但事实并非如此。
- 产品文档说,“按 F5。这将在新的扩展开发主机 window 中编译和 运行 扩展。”但是,对我来说情况并非如此。不确定,它实际上在哪里失败了。
- 我已针对此问题向 Microsoft 提交了一个错误。
https://github.com/microsoft/vscode-extension-samples/issues/510
问题描述:
我尝试使用文档中提供的示例扩展(哟代码)创建 VS 代码扩展。在创建它时,我选择了“打字稿”作为扩展类型。 当我尝试 运行 扩展时,我收到一条错误消息。
Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found)
Activating extension 'undefined_publisher.vscode-err-reproduce' failed: Cannot find module
'/oct/vscode-extn-ts-error/vscode-err-reproduce/out/extension.js' Require stack: - /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js.
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"outDir": "out",
"lib": [
"ES2020"
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": [
"node_modules",
".vscode-test"
]
}
错误是由于编译未 运行 或未能 运行 启动扩展。因此 .js 文件不会在 /out/* 目录
上创建- 我通过从根目录手动 运行ning tsc --watch 解决了这个问题。
- 我以为,默认情况下启动扩展会触发编译,但事实并非如此。
- 产品文档说,“按 F5。这将在新的扩展开发主机 window 中编译和 运行 扩展。”但是,对我来说情况并非如此。不确定,它实际上在哪里失败了。
- 我已针对此问题向 Microsoft 提交了一个错误。
https://github.com/microsoft/vscode-extension-samples/issues/510