VSCode启动设置中的自定义变量?

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

是否可以添加可在launch.json设置中使用的自定义变量,以便在VSCode中进行调试?当前,我发现的唯一方法是将它们添加到我的工作区设置中,并从${config} predefined variable引用。

我想在launch.json中定义变量/属性并使用它们。这是一个示例,如果我想将myCustomVar添加到我的所有URL中,可能会看起来像:

{
    "version": "0.2.0",
    "myCustomVar": "my_value",
    "configurations": [
        {
            "name": "Page 1",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost/page1.html?customVar=${myCustomVar}",
            "sourceMaps": true,
            "webRoot": "${workspaceFolder}/dev"
        },
        {
            "name": "Page 2",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost/page2.html?customVar=${myCustomVar}",
            "sourceMaps": true,
            "webRoot": "${workspaceFolder}/dev"
        }
}

是否可以添加可在launch.json设置中使用的自定义变量,以便在VSCode中进行调试?目前,我发现的唯一方法是将它们添加到我的工作空间设置中,并参考...

visual-studio-code vscode-settings
1个回答
0
投票

Input variables可能起作用?

© www.soinside.com 2019 - 2024. All rights reserved.