visual-studio-codeclang-format

How to Fix Casing of Visual Studio Code clang-format Command-Line


Previously, Visual Studio Code was correctly applying formatting on save as specified in a .clang-format file. However, recently (sometime in the last month or so) this broke on a case-sensitive file system. The following is what is getting printed in the output console when I try to format the file myCamelCaseFile.c:

Formatting failed:

c:\Users\JeffG\.vscode\extensions\ms-vscode.cpptools-1.19.6-win32-x64/bin/../LLVM/bin/clang-format.exe "-style={ BasedOnStyle: LLVM }" -fallback-style=LLVM -sort-includes=0 --Wno-error=unknown -assume-filename=\\CaseSensitiveFS\some\path\mycamelcasefile.c \\CaseSensitiveFS\SOME\PATH\MYCAMELCASEFILE.C

The generated formatting command is converting the full path (other than the remote server) to uppercase. Correcting the casing on the uppercase path fixes the command (note that the lowercase path is also incorrect, but it doesn't seem to matter). How can I configure the clang-format command line to prevent modifying the path casing?


Solution

  • This is a bug introduced in version 1.19 of the C/C++ VSCode extension. Reverting to version 1.18.5 fixed the auto-formatting.