为什么当我初始化第一个 vscode 扩展时没有匹配的命令?

Phi*_*l W 5 visual-studio-code vscode-extensions

我在这个页面之后初始化了我的第一个 vscode 扩展。

这是我的步骤:

  1. npm install -g yo 生成器代码
  2. 哟代码

这是生成的 package.json:

{
  "name": "helloworld",
  "displayName": "helloworld",
  "description": "description helloworld",
  "version": "0.0.1",
  "engines": {
    "vscode": "^1.72.0"
  },
  "categories": [
    "Other"
  ],
  "activationEvents": [
    "onCommand:helloworld.helloWorld"
  ],
  "main": "./out/extension.js",
  "contributes": {
    "commands": [
      {
        "command": "helloworld.helloWorld",
        "title": "Hello World"
      }
    ]
  },
  "scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "tsc -p ./",
    "watch": "tsc -watch -p ./",
    "pretest": "npm run compile && npm run lint",
    "lint": "eslint src --ext ts",
    "test": "node ./out/test/runTest.js"
  },
  "devDependencies": {
    "@types/glob": "^8.0.0",
    "@types/mocha": "^10.0.0",
    "@types/node": "16.x",
    "@types/vscode": "^1.72.0",
    "@typescript-eslint/eslint-plugin": "^5.38.1",
    "@typescript-eslint/parser": "^5.38.1",
    "@vscode/test-electron": "^2.1.5",
    "eslint": "^8.24.0",
    "glob": "^8.0.3",
    "mocha": "^10.0.0",
    "typescript": "^4.8.4"
  }
}
Run Code Online (Sandbox Code Playgroud)

当我按 H5 进行调试时,我在这里没有匹配的命令: 在此输入图像描述

我被困在这里一段时间了,我的命令在哪里?

tac*_*ice 12

我刚才也遇到了这个情况。确保与engines.vscodepackage.json正在运行的 vscode 版本匹配:

"engines": {
  "vscode": "^1.73.0"
},
Run Code Online (Sandbox Code Playgroud)

我猜生成器将使用可用的最新版本,但您可能尚未升级。我就是这种情况。