microsoft / microsoft/vscode-cpptools

C_Cpp.vcFormat.space.withinSquareBrackets bug on first line

Aperta
#10,583 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il problema in VS Code con C_Cpp.vcFormat.space.withinSquareBrackets abilitato e l’esempio di inizializzatore designato riportato nel report. Traccia il percorso di formattazione C/C++ utilizzato dall’estensione; il lavoro è completato quando il primo inizializzatore di array riceve spazi all’interno delle parentesi quadre, come gli inizializzatori successivi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, cpp, typescript
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.