vscode-cpptools
vscode-cpptools copied to clipboard
Weird behaviour with vcFormat and lambdas
Environment
- OS and Version: windows 10
- VS Code Version: 1.69.2
- C/C++ Extension Version: 1.11.5
- Other extensions you installed (and if the issue persists after disabling them):
- If using SSH remote, specify OS of remote machine: No ssh
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc): vcFormat makes lamdbas in function calls inside function calls weird
Bug Summary and Steps to Reproduce
Bug Summary: with these settings "C_Cpp.formatting": "vcFormat" "C_Cpp.vcFormat.indent.lambdaBracesWhenParameter": true "C_Cpp.vcFormat.indent.multiLineRelativeTo": "innermostParenthesis" every other setting is default also when C_Cpp.vcFormat.indent.multiLineRelativeTo is set to both it's other parameters
Expected behavior
No response
Code sample and Logs
template<typename... Ts>
void a_function(Ts...){
}
template<typename T>
T another_function(T t){
return t;
}
int main(){
//before formatting
a_function(
another_function([]() {
return 1;
}),
another_function([]() {
return 2;
}),
another_function([]() {
return 3;
}),
another_function([]() {
return 3;
}),
another_function([]() {
return 3;
}),
another_function([]() {
return 3;
})
);
//after formatting
a_function(
another_function([]() {
return 1;
}),
another_function([]() {
return 2;
}),
another_function([]() {
return 3;
}),
another_function([]() {
return 3;
}),
another_function([]() {
return 3;
}),
another_function([]() {
return 3;
})
);
}
Screenshots
Additional context
No response
@cerww Thank you for reporting this issue. The VS Code C++ extension shares the vcFormat implementation with Visual Studio (VS) and this reproduces in VS. I opened a bug against VS internally.
Is there an update or a link to the "internally bug report"?
I have more strange behaviours to present:
- Using Lambda-Functions:
function_call([]() {
char x;
char z;
char z;
});
Expected:
function_call([]() {
char x;
char z;
char z;
});
- Using Macro-Functions:
#define Macroname(a) if (a) {return;}
...
Macroname()
char x;
Expected:
#define Macroname(a) if (a) {return;}
...
Macroname()
char x;
@GURKE The internal bug is 1600301. It's not fixed yet. UPDATE: It looks like a fix is planned "soon", maybe for 1.15.0.
Your new issue 1 is already fixed with our pending 1.14.0: https://github.com/microsoft/vscode-cpptools/issues/10326 .
Your new issue 2 I moved to https://github.com/microsoft/vscode-cpptools/issues/10327 (I filed an issue on VS at https://github.com/microsoft/vscode-cpptools/issues/10327 ).