[vcFormat] Extra spaces around `=` are removed if `space.aroundAssignmentOperator` is set to `insert`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Empieza localizando la implementación de vcFormat y las pruebas de C_Cpp.vcFormat.space.aroundAssignmentOperator. Reproduce el ejemplo de enum en un archivo .c con la configuración establecida en insert y, a continuación, verifica que el formateador conserve los espacios de alineación existentes y siga gestionando los lados sin espacio.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode-cpptools
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Abiertobug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 asignado ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 comentario · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
microsoft/vscode-cpptools#14769 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
microsoft/vscode-cpptools#14768 · 1 comentario ·
Todos los issues de microsoft/vscode-cpptools
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
copse-dev/agent-pane#2953 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Abiertobug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Client support matrix inclusion Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
calcite-components needs triage refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Esri/calcite-design-system#15203 ·