开发时如何向VS代码扩展传递参数?

问题描述 投票:0回答:1

这是 .vscode/launch.json 中的配置,我用它来启动扩展进行调试:

        {
            "name": "extension",
            "type": "extensionHost",
            "request": "launch",
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "outFiles": [
                "${workspaceFolder}/dist/**/*.js"
            ],
            "preLaunchTask": "${defaultBuildTask}",
            "cwd": "extension",
        },

这就是我在 pubspec.json 中的内容:

"scripts": {
    "vscode:prepublish": "npm run package",
    "compile": "npm run check-types && npm run lint && node esbuild.js",
    "watch": "npm-run-all -p watch:*",
    "watch:esbuild": "node esbuild.js --watch",
    "watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
    "package": "npm run check-types && npm run lint && node esbuild.js --production",
    "compile-tests": "tsc -p . --outDir out",
    "watch-tests": "tsc -p . -w --outDir out",
    "pretest": "npm run compile-tests && npm run compile && npm run lint",
    "check-types": "tsc --noEmit",
    "lint": "eslint src",
    "test": "vscode-test"
  },

我如何调整它来传递标志(编译时间没问题),这会说我需要一些不同的值?

vscode-extensions
1个回答
0
投票

是的,可以在 pubspec.json 中更新 watch 以传递标志:

"watch": "export FOO=bar && npm-run-all -p watch:*"
© www.soinside.com 2019 - 2024. All rights reserved.