C_Cpp.vcFormat.space.withinSquareBrackets bug on first line

Offen
#10,583 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
c, cpp, typescript
Bereich
tooling

Rechercherichtung

Reproduziere das Problem in VS Code mit aktiviertem C_Cpp.vcFormat.space.withinSquareBrackets und dem Designated-Initializer-Beispiel aus dem Bericht. Verfolge den von der Erweiterung verwendeten C/C++-Formatierungspfad; abgeschlossen ist die Aufgabe, wenn der erste Array-Initializer Leerzeichen innerhalb seiner Klammern erhält und damit den späteren Initializern entspricht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug Language Service Visual Studio
Environment
  • OS and Version: Mac OS Ventura 13.2.1
  • VS Code Version: 1.75.1
  • C/C++ Extension Version: 1.14.3
  • If using SSH remote, specify OS of remote machine: N/A
Bug Summary and Steps to Reproduce

Bug Summary:

C_Cpp.vcFormat.space.withinSquareBrackets setting doesn't insert a space within the square brackets for the first designated initializer for an array.

Steps to reproduce:

  1. Set "C_Cpp.vcFormat.space.withinSquareBrackets": true, in settings.json.
  2. Create a new C file
  3. Put in this code:
int array[] = {
    [0] = 0,
    [1] = 1,
    [2] = 2,
};
  1. Format with C/C++.

Code should be formatted to

int array[] = {
    [ 0 ] = 0,
    [ 1 ] = 1,
    [ 2 ] = 2,
};

Instead, the file is formatted to

int array[] = {
    [0] = 0,
    [ 1 ] = 1,
    [ 2 ] = 2,
};
Configuration and Logs
    "C_Cpp.vcFormat.indent.caseLabels": true,
    "C_Cpp.vcFormat.indent.preserveWithinParentheses": false,
    "C_Cpp.vcFormat.indent.multiLineRelativeTo": "outermostParenthesis",
    "C_Cpp.vcFormat.wrap.preserveBlocks": "never",
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.block": "newLine",
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.function": "newLine",
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.namespace": "sameLine",
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.type": "sameLine",
    "C_Cpp.vcFormat.newLine.beforeWhileInDoWhile": true,
    "C_Cpp.vcFormat.newLine.closeBraceSameLine.emptyFunction": true,
    "C_Cpp.vcFormat.newLine.closeBraceSameLine.emptyType": true,
    "C_Cpp.vcFormat.space.aroundAssignmentOperator": "ignore",
    "C_Cpp.vcFormat.space.beforeBlockOpenBrace": true,
    "C_Cpp.vcFormat.space.beforeInitializerListOpenBrace": true,
    "C_Cpp.vcFormat.space.afterCastCloseParenthesis": true,
    "C_Cpp.vcFormat.space.betweenEmptyParameterListParentheses": false,
    "C_Cpp.vcFormat.space.betweenEmptyBraces": true,
    "C_Cpp.vcFormat.space.betweenEmptySquareBrackets": false,
    "C_Cpp.vcFormat.space.pointerReferenceAlignment": "left",
    "C_Cpp.vcFormat.space.withinCastParentheses": true,
    "C_Cpp.vcFormat.space.withinControlFlowStatementParentheses": true,
    "C_Cpp.vcFormat.space.withinExpressionParentheses": true,
    "C_Cpp.vcFormat.space.withinLambdaBrackets": true,
    "C_Cpp.vcFormat.space.withinParameterListParentheses": true,
    "C_Cpp.vcFormat.space.withinSquareBrackets": true,
    "C_Cpp.vcFormat.space.withinInitializerListBraces": true,
    "C_Cpp.vcFormat.space.removeAroundMemberOperators": false,
    "C_Cpp.formatting": "vcFormat",
Other Extensions

N/A

Additional context

No response

Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/vscode-cpptools

Alle Issues in microsoft/vscode-cpptools

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.