microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.4k stars 1.51k forks source link

Error while formatting C++ code with clang-format.exe intergrated in the extension #12289

Open andywowws opened 1 month ago

andywowws commented 1 month ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:Have an error while formatting: Formatting failed: c:\Users\Administrator.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64/bin/../LLVM/bin/clang-format.exe -style=file -fallback-style=google -sort-includes=0 --Wno-error=unknown -assume-filename=D:\lgtm\P3612.cpp D:\LGTM\P3612.CPP

Steps to reproduce:

  1. Press "Shift+Alt+F"
  2. See error

Expected behavior: No such error just as version 1.19.9 of the extension
.clang-format

---
# 语言: None, Cpp, Java, JavaScript, ObjC, Proto, TableGen, TextProto
Language: Cpp
# 基于某一主题上的修改
BasedOnStyle: Google
# 缩进宽度
IndentWidth: 4
# 缩进case标签
IndentCaseLabels: true
# 访问说明符(public、private等)的偏移
AccessModifierOffset: -4
# 括号之前不断行
BreakBeforeBraces: Attach
#
AllowShortIfStatementsOnASingleLine: false
#
AllowShortLoopsOnASingleLine: false

Configuration and Logs

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:/mingw64/bin/g++.exe",
            "cStandard": "c17",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

log
Formatting failed:
c:\Users\Administrator\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64/bin/../LLVM/bin/clang-format.exe -style=file -fallback-style=google -sort-includes=0 --Wno-error=unknown -assume-filename=D:\lgtm\P3612.cpp D:\LGTM\P3612.CPP

Other Extensions

No response

Additional context

No response

andywowws commented 1 month ago

The bug seems to only appear on Windows 10, not Windows 11.

andywowws commented 1 month ago

These are two clang-format.exe intergrated in 1.19.9 and 1.20.5 1.19.9: clang-format_1.19.9.zip 1.20.5: clang-format_1.20.5.zip