It was nice to be able to set C_Cpp.clang_format_path in the workspace settings so that workspaces can use different versions of clang-format as the included clang-format with vscode-cpptools may conflict with existing projects.. if the extension has one version of clang-format but CI has another it leads to formatting check failures...
please add back the ability to set C_Cpp.clang_format_path in workspace config (.code-workspace)
This changed because clang_format_path is machine specific and causes problems for the remote scenario unless we flag it as machine specific. See https://github.com/microsoft/vscode-cpptools/issues/3774 .
Can you set the user or machine setting?
I just explained why it does not work for user setting.
1) User setting is global. User formats using global settings.
2) User submits code to CI, CI uses another version and format differ.
Before we used to be able to set this in the workspace settings, so that we can guarantee that the clang-format versions match between workspace and CI. Now we can't, making formatting in editor unusable.
Seems like remote scenario needs to be be aware and do something different, feel like breaking local scenario for remote is a bit much.
@sandy081 Why can't the machine scoped settings be made per-workspace? How do you recommend we fix this? Revert back to the "resource" scope?
yea, machine scoped per-workspace would definitely fit this use-case. hopefully it could be possible at some point :) if it isn't already
and workaround currently is to just format on command line with a script, but it is nice to get formatting in editor to see the results instantly, but certainly not something that is a total blocker
@sean-mcmanus Yes machine scoped settings cannot be overridden in workspace as they are paths.
There is open discussion on it to support or not. We will take a decision soon and upate - https://github.com/microsoft/vscode/issues/73985
FWIW I work daily on two different codebases and each is using a different version of clang-format. Using the wrong version for a given codebase yields formatting errors that are enforced in CI... so for me a workspace setting was appropriate. I'm not sure what to do now... write a wrapper script?
You could try setting the C_Cpp.formatting setting to "Disabled" and using the clang-format extension instead for formatting (I don't know if they've moved to machines scopes yet).
Please fix this. Auto-formatting is a huge plus and this change has totally broken it for me (again, different projects on the same machine using different clang-format versions). Also, with the way our development environment is set up, .code-workspace file is exactly the right place for this path (since it can be defined relative to the {workspaceFolder}
We'll change it back to use the "resource" scope for now, and then later change it to use the "machine-overridable" scope.
Should be fixed with 0.25.0. I filed https://github.com/microsoft/vscode-cpptools/issues/4121 for switching to machine-overridable scope.