【问题标题】:Multiple platforms vscode launch.json config slashes多平台 vscode launch.json 配置斜杠
【发布时间】:2016-09-16 21:15:05
【问题描述】:

我正在开发一个打字稿项目,其中一个开发人员在 Windows 上,另一个在 Mac OS 上,我目前遇到的问题是目录的斜杠不起作用(Windows \ 和 Mac OS / )。 在 .vscode 目录中的 launch.json 文件中,我有一个这样的配置:

{
    "version": "0.2.0",
    "configurations": [
        {
            "program": "${workspaceRoot}/src/main.ts",
            "cwd": "${workspaceRoot}/tests/reference"
        }
    ]
}

所以我尝试这样做:

{
    "version": "0.2.0",
    "osx" : {
        "configurations": [
            {
                "name": "Launch",
                "type": "node",
                "request": "launch",
                "program": "${workspaceRoot}/src/main.ts",
                "cwd": "${workspaceRoot}/tests/reference"
            }
        ]
    },
    "windows" : {
        "configurations": [
            {
                "name": "Launch",
                "type": "node",
                "request": "launch",
                "program": "${workspaceRoot}\\src\\main.ts",
                "cwd": "${workspaceRoot}\\tests\\reference"
            }
        ]
    }
}

但是编译器抱怨配置不存在,所以我想我不能这样做。

【问题讨论】:

    标签: windows macos typescript visual-studio-code platform


    【解决方案1】:

    最后,事实证明您可以使用单个正斜杠,这适用于 Windows、OSX 和 Linux。

    {
        "version": "0.2.0",
        "configurations": [
            {
                "program": "${workspaceRoot}/src/main.ts",
                "cwd": "${workspaceRoot}/tests/reference"
            }
        ]
    }
    

    以前我一直试图让 \ 工作,但显然不会。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-13
      • 1970-01-01
      • 1970-01-01
      • 2019-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多