microsoft / microsoft/vscode-cpptools
Weird behaviour with vcFormat and lambdas
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report in the issue's Windows 10, VS Code 1.69.2, and C/C++ extension 1.11.5 setup using the supplied C++ sample and vcFormat settings. Compare the formatter's output for nested lambdas under each multiLineRelativeTo option; done means the output no longer develops inconsistent indentation and matches the intended lambda-brace setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100