vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Update clang-format settings to support file:

Open EcotechBrad opened this issue 1 year ago • 2 comments

Feature Request

in Clang-format v14 you can specify a file path using -style=file:<path-to-file> however, variable expansions do not work in setting "C_Cpp.clang_format_style"

i.e something like "C_Cpp.clang_format_style": "file:${workspaceFolder}/tools/.clang-format" is not expanded, and returns

Formatting failed: "C:\Program Files\LLVM\bin\clang-format.exe" -style=file:${workspacefolder}/tools/.clang-format

if someone could point me to where variables like clangFormatPath are expanded i could open a PR myself,

i've already tried adding util.resolveVariables in client.ts mimicking settings_clangFormatPath.push(util.resolveVariables(setting.clangFormatPath, this.AdditionalEnvironment));

  commit: 5d736cc6c8e07be89b1b79a2ceb124243304a434 file client.ts line 1125
  settings_clangFormatStyle.push(util.resolveVariables(setting.clangFormatStyle, this.AdditionalEnvironment)); 

however no luck.

EcotechBrad avatar Aug 25 '22 18:08 EcotechBrad

Thanks for reporting this. The resolving of the ${workspaceFolder} is done in our closed source code -- it should be fixed in 1.13.0.

sean-mcmanus avatar Aug 25 '22 22:08 sean-mcmanus

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.13.0 .

sean-mcmanus avatar Sep 12 '22 17:09 sean-mcmanus