debugging F5在Vscode扩展开发中不起作用

cl25kdpy  于 2023-03-03  发布在  Vscode
关注(0)|答案(1)|浏览(219)

我正在为Vscode创建一个新的扩展。我正在遵循“youre first extension“指南。当我按下F5时,绝对没有任何React。

我的系统是:

  • vscode版本1.76.0
  • windows 11 x64
  • 节点版本v18.12.1
  • 国家预防机制版本9.2.0
    我已经检查的内容:
  • 节点已安装。
  • Yo代码已安装。
  • VSCE已安装。
  • 我在我的分机的根目录中。
  • 关闭并重新打开Vscode。
  • This issue没有解决我的问题。

我能做些什么让F5工作?
我还没有在文件中改变任何东西.这是我的文件:
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}"
        }
    ]
}

tasks.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
            }
        }
    ]
}

package.json

{
  "name": "xxxxx",
  "displayName": "xxxxx",
  "description": "xxxxx",
  "version": "0.0.1",
  "engines": {
    "vscode": "^1.76.0"
  },
  "categories": [
    "Other"
  ],
  "activationEvents": [],
  "main": "./out/extension.js",
  "contributes": {
    "commands": [
      {
        "command": "xxxxx",
        "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/vscode": "^1.76.0",
    "@types/glob": "^8.1.0",
    "@types/mocha": "^10.0.1",
    "@types/node": "16.x",
    "@typescript-eslint/eslint-plugin": "^5.53.0",
    "@typescript-eslint/parser": "^5.53.0",
    "eslint": "^8.34.0",
    "glob": "^8.1.0",
    "mocha": "^10.2.0",
    "typescript": "^4.9.5",
    "@vscode/test-electron": "^2.2.3"
  }
}
y53ybaqx

y53ybaqx1#

由于您的问题可能与I cannot build my VSCode extension project in VSCode after update to 1.76相同,我强烈建议您在那里添加您的信息,以防原始OP不响应更多信息的请求,并帮助开发人员弄清楚发生了什么。
在此期间,你可能想降级到v1.75.2,看看它是否工作。顺便说一句,启动一个扩展的调试会话仍然为我在v1.76工作,所以你的具体信息将是有价值的问题。
我正在添加我的启动配置以进行比较:

{
            "name": "Run Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "${workspaceFolder}/../OneDrive/TestMultiRoot",  // this is what the ExtensionHost will open
                "--extensionDevelopmentPath=${workspaceFolder}"
            ]
        }

它和你的很不一样,也许我用的是旧版本的yo生成器?你可以试着把它复制到你的launch.json中,注解掉你当前的版本,看看会发生什么。

相关问题