【问题标题】:VSCode Custom Variables in Launch Settings?启动设置中的 VSCode 自定义变量?
【发布时间】:2018-11-08 11:32:21
【问题描述】:

有没有办法添加可以在我的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"
        }
}

【问题讨论】:

    标签: visual-studio-code vscode-settings


    【解决方案1】:

    Input variables 可能有用吗?

    否则,您应该能够将自定义设置添加到您的 VS Code settings.json 文件(它会警告您“未知配置设置”)并使用 ${config:myCustomVar} 插入它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-29
      • 1970-01-01
      • 2017-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多