简体   繁体   English

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

[英]Why No Matching Commands when I init my first vscode extension?

I init my first vscode extension following this page .我在这个页面之后初始化了我的第一个 vscode 扩展。

Here is my steps:这是我的步骤:

  1. npm install -g yo generator-code npm 安装-g yo 生成器代码
  2. yo code哟代码

And here is the package.json generated:这是生成的 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"
  }
}

When I press H5 to debug, I got no command matched here:当我按 H5 进行调试时,我没有找到匹配的命令: 在此处输入图像描述

I was stuck here for a while, where is my command??我被困在这里一段时间了,我的命令在哪里??

I've encountered this just now as well.我刚才也遇到了这个。 Make sure that engines.vscode in package.json matches the version of vscode you are running:确保 package.json 中的engines.vscode与您正在运行的package.json版本匹配:

"engines": {
  "vscode": "^1.73.0"
},

I guess the generator will use the latest version available, but you might not have upgraded yet.我猜生成器将使用可用的最新版本,但您可能尚未升级。 That was the case for me.我就是这种情况。

@tacospice pointed out exactly. @tacospice 准确指出。 in package.json , engines.vscode determines minimum version of VSCode.package.json中, engines.vscode确定 VSCode 的最低版本。 In my case, yo created extension template which set minimum VSCode version(1.74.0) newer than working VSCode(1.70.0).在我的例子中, yo创建了扩展模板,它设置了比工作 VSCode (1.70.0) 更新的最低 VSCode 版本 (1.74.0)。 Check Help -> About -> version with package.json .使用package.json检查Help -> About -> version

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的 vscode 在我运行扩展时总是显示构建? - Why my vscode always show building when I run extension? 当我将“.py”扩展名与 CMD 命令一起使用时,VSCode 会启动 - VSCode starts up when I use “.py” extension with CMD commands 为什么我无法调试我的 vscode 扩展? - Why am I unable to debug my vscode extension? 为什么 stylelint vscode 扩展不能在我的电脑上运行? - Why the stylelint vscode extension is not working on my computer? 在VSCode扩展中注册多个命令 - Registration of multiple commands in VSCode extension 为什么我输入scanf时我的VScode不起作用? - Why does my VScode not work when I input scanf? 为什么我的方案代码括号没有颜色,即使我已经安装了 vscode-scheme 扩展 - why my scheme code parenthesis have no colors even I've installed vscode-scheme extension 为什么当我将 select vscode-icons 扩展名作为我在 Visual Studio Code 中的首选文件图标主题时,文件和文件夹图标会消失? - Why does file and folder icons disappear when I select vscode-icons extension as my preferred File Icon Theme in Visual Studio Code? 如何解决我在安装 vscode 以测试我的扩展程序时遇到的错误? - How to resolve an error which i am getting when installing vscode for testing my extension? 当用户创建嵌入式终端时,如何从我的 VSCode 扩展中更改嵌入式终端的名称? - How do I change the name of the embedded terminal from my VSCode extension when it is created by the user?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM