microsoft / microsoft/vscode-cpptools
Weird behaviour with vcFormat and lambdas
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den Bericht in der im Issue angegebenen Umgebung mit Windows 10, VS Code 1.69.2 und der C/C++ extension 1.11.5 anhand des bereitgestellten C++-Beispiels und der vcFormat-Einstellungen nachzustellen. Vergleiche die Ausgabe des Formatters für verschachtelte Lambdas unter jeder multiLineRelativeTo-Option; als erledigt gilt die Aufgabe, wenn die Ausgabe keine inkonsistente Einrückung mehr entwickelt und der vorgesehenen Einstellung für Lambda-Klammern entspricht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100