microsoft / microsoft/vscode-cpptools
Wrong or unchanged indentation when initializing structs.
Offen
Dieses Issue hat noch niemand übernommen.
bug
Feature: Code Formatting
Language Service
Visual Studio
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Bug type: Language Service
With VSCode 1.56 (April 2021) & cpptools 1.4.1
There are problems with the indentations of struct initializers.
- When initializing a variable, the indentation is unchanged.
- When returning, the indentation is changed but wrong.
- The first line is correct.
- The rest is double-indented.
typedef struct thing {
int a;
int b;
} thing;
thing get_thing() {
/* In these situations: indentation is unchanged */
thing a = {
10, // wrong indentation not corrected
10 // wrong indentation not corrected
};
thing t = {
.a = 10, // wrong indentation not corrected
.b = 10 // wrong indentation not corrected
};
t = (thing){
.a = 10, // had to manually indent those ones
.b = 10 // indentation is unchanged by formatter
};
/* In these situations: indentation is worng */
return (thing) {
.a = 10, // good
.b = 10 // wrong indentation formatted
};
}
Configuration:
"C_Cpp.formatting": "vcFormat"
"C_Cpp.vcFormat.indent.caseLabels": true
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
Reproduziere das Problem anhand des eingebetteten Beispiels für einen C-Strukturinitialisierer mit auf vcFormat gesetztem C_Cpp.formatting und der aufgeführten Einrückungseinstellung. Verfolge die Verarbeitung von vcFormat für Variableninitialisierungen und Rückgabeausdrücke und überprüfe anschließend, dass die resultierende Einrückung dem erwarteten Layout des Beispiels entspricht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, typescript, vscode
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100