[vcFormat] Extra spaces around `=` are removed if `space.aroundAssignmentOperator` is set to `insert`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia individuando l'implementazione di vcFormat e i test per C_Cpp.vcFormat.space.aroundAssignmentOperator. Riproduci l'esempio di enum in un file .c con l'impostazione su insert, quindi verifica che il formatter mantenga gli spazi di allineamento esistenti continuando a gestire i lati privi di spazio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- OS and Version: Various (assuming all)
- VS Code Version: 1.117.0
- C/C++ Extension Version: 1.31.5
Bug Summary and Steps to Reproduce
Bug Summary:
When C_Cpp.vcFormat.space.aroundAssignmentOperator is set to insert, vcFormat will remove all extra spaces around an assignment operator leaving exactly one space on each side. However, there many times where extra spaces are warranted for the sake of columnar alignment to improve readability.
Therefore, I believe there are two possible solutions to this problem:
- Change the behavior of
insertso that it only modifies the file by adding a space if no space is present on a side of the assignment operator - Remove the
insertandremoveoptions and replace them with the following options (retaining theignoreoption):none: Formatter will remove spaces from both sides of the assignment operatorone: Formatter will add or remove spaces from both sides of the assignment operator so that the result is one space on each side of the assignment operatoroneOrMore: Formatter will only add one space to a side of the assignment operator if zero spaces exist on that side. If one or more spaces exist, the formatter will not make any changes.
Steps to reproduce:
- Ensure
C_Cpp.vcFormat.space.aroundAssignmentOperatoris set toinsert - Add the following lines to a .c file:
enum {
short_name = 0x00,
longer_name = 0x01,
even_longer_name = 0x02,
another_longer_name = 0x04,
shorter_name = 0x08,
};
- Format the file using vcFormat
Expected behavior:
- The file should not change
Actual output:
enum {
short_name = 0x00,
longer_name = 0x01,
even_longer_name = 0x02,
another_longer_name = 0x04,
shorter_name = 0x08,
};
Configuration and Logs
N/A
Other Extensions
No response
Additional context
No response
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
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.
Altre issue di microsoft/vscode-cpptools
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Apertabug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 assegnatario ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 commento · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
microsoft/vscode-cpptools#14769 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
microsoft/vscode-cpptools#14768 · 1 commento ·
Tutte le issue di microsoft/vscode-cpptools
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
copse-dev/agent-pane#2953 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Apertabug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·