Formatter moves a line comment in a switch/if/loop operand into the block
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- ocaml
- Área
- tooling
Línea de trabajo
The issue describes the formatter’s line suffix handling and gives operand examples, but names no source files or tests. Start by locating the printer logic that queues trailing line comments and the formatter tests for switch, if, loop, and try operands. Add cases that verify comments stay in the operand across repeated formatting; done means formatting is idempotent for the examples. Pull request #9061 is already open.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
A line comment inside the operand of switch, if, while, for, for..of, for await..of or try moves when formatting: first after the {, then on the next run into the block. Formatting is not idempotent.
switch obj // c
.x {
| _ => ()
}
First run:
switch obj.x { // c
| _ => ()
}
Second run, the comment is now in the block:
switch obj.x {
// c
| _ => ()
}
The same happens with if, while, for..of, for await..of, try (where the comment moves past catch) and with these operands:
obj // c\n.x.yandobj // c\n.x // d\n.yarr[// c\n0],obj[// c\n"member"],obj["member"] // c\n{obj // c\n->fa // c\n+ bfor i in 0 // c\nto n {: the comment moves pastto nand into the loop body
switch f(// c\nx) { is fine, because the arguments group breaks after the comment.
Expected: the comment stays in the operand, for example
switch (
obj.x // c
) {
| _ => ()
}
Cause: the printer queues a trailing line comment as a line suffix and prints it at the next line break of a breaking group. The field access, object get, pipe or binary expression is printed flat with no line break after the comment, so the first break is the one after the block's {.
Found while reviewing #8906, which is about a related case, but this bug is already on master.
- Lenguaje dominante
- OCaml
- Estrellas
- 7.5k
- Forks
- 483
- Merge medio
- 20 h 7 min
- PR fusionados (30 d)
- 227
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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 rescript-lang/rescript
-
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
rescript-lang/rescript#9063 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
rescript-lang/rescript#9058 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
RFC: Temporal API bindingsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
rescript-lang/rescript#9044 · 1 comentario · 3 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
rescript-lang/rescript#9006 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Have formatter insert newlines around multi-line expressionsPosiblemente ocupada @rolandpeelen la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
rescript-lang/rescript#8960 ·
Los mantenedores suelen responder en 1 día
Todos los issues de rescript-lang/rescript
Issues similares
-
[Bug]: php, php-nts: checkver misses the rebuilt Windows packages 8.5.12-1 (Brotli security fix)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ScoopInstaller/Main#8775 ·
Los mantenedores suelen responder en 1 día
-
agent-reported area/react bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Nimblesite/SharpLsp#510 ·
Los mantenedores suelen responder en 1 día
-
templates/plan.md lista o agente "Tracer", mas o pacote não inclui nenhum skill/agente com esse nomeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
OpenLiberty/ci.maven#2137 ·
Los mantenedores suelen responder en 1 día