microsoft / microsoft/vscode-cpptools
Weird behaviour with vcFormat and lambdas
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il problema riportato nell’issue nella configurazione indicata, con Windows 10, VS Code 1.69.2 e l’estensione C/C++ 1.11.5, usando l’esempio C++ e le impostazioni vcFormat forniti. Confronta l’output del formatter per le lambda annidate con ogni opzione multiLineRelativeTo; il lavoro è completato quando l’output non sviluppa più un’indentazione incoerente e corrisponde all’impostazione prevista per le parentesi graffe delle lambda.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100