cheshirekow / cmake_format

Source code formatter for cmake listfiles.
GNU General Public License v3.0
941 stars 103 forks source link

VS Code extension: ${workspaceFolder} prefixed with '/' on Windows #327

Open marthinsen opened 11 months ago

marthinsen commented 11 months ago

Using the current settings.json in VS Code on Windows:

{
    "cmakeFormat.args": [
        "--config-file",
        "${workspaceFolder}/CMake/cmake-format.yaml"
    ]
}

the ${workspaceFolder} will be prepended with a leading slash which cmake-format is not able to understand and fail with the error message: CRITICAL __main__.py:635: Desired config file does not exist: /c:/path/to/workspace/CMake/cmake-format.yaml

The error seems to be that path is used here instead of fsPath: https://github.com/cheshirekow/cmake_format/blob/eff5df1f41c665ea7cac799396042e4f406ef09a/cmakelang/vscode_extension/src/extension.ts#L39C5-L39C5 Difference between path and fsPath: https://code.visualstudio.com/api/references/vscode-api#Uri.fsPath