Visual editor ignores changes made to its file outside it while it has focus
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- developer-experience
Línea de trabajo
Start by tracing how the visual editor handles document change events while it has focus, and how it distinguishes its own writes from external file changes. The issue names no source files or tests, so locate the editor’s document synchronization entry points and related tests first. Done means external changes appear when there are no pending editor changes, and simultaneous changes prompt the user to choose how to proceed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
When the visual editor has focus, it does not show any changes that come from outside it. For example, a coding agent, a script, or git checkout can change the file but the visual editor keeps its old content. Then, if you type in the visual editor, its next write puts the old content back over the outside change. The outside change is lost and you see no warning or any indication what happened. If auto-save is on, the change is also lost on disk.
This is probably happening more often now that people use coding agents that edit files while the visual editor is open.
Steps to reproduce
- Create
test.qmdwith a heading and two paragraphs, and save it. To see the change lost on disk, set"files.autoSave": "afterDelay". - Open the file with Quarto: Edit in Visual Mode.
- In the integrated terminal, run this command:
sleep 10 && echo "Line added from outside" >> test.qmd - Before the 10 seconds end, click in the body text of the visual editor.
- Wait for approximately 5 seconds. The new line does not show in the visual editor.
tail -n 1 test.qmdshows that the line is in the file. - Type one character in the visual editor and wait for approximately 3 seconds.
- Run
tail -n 1 test.qmdagain. The new line is not in the file.
If the focus stays in the terminal in step 4, the new line shows in the visual editor after approximately 1 second.
Why this is difficult
The visual editor ignores outside changes while it has focus on purpose. This rule stops its own writes from coming back to it and resetting it while you type. A fix would need to distinguish between outside changes and these writes. A fix also needs to decide what to do when both sides change the file at the same time. If the outside change always wins, you can lose the text that you typed in the last few seconds. If the visual editor always wins, the outside change is lost.
PR #1234 has one approach. In that approach, the outside change always wins.
A possible approach
I think that a better approach would not choose a winner without telling you:
- If the visual editor has no changes that it did not write to the document yet, it shows the outside change, also when it has focus. No work would be lost in this case. This case is the usual one for a coding agent, because the agent usually edits the file when you are not typing.
- If both sides have changes, the visual editor tells you that the file changed outside it. You then select to load the outside change or to keep your changes in the visual editor, maybe in a diff view of some kind. (The visual editor doesn't provide a diff view right now.)
- Lenguaje dominante
- TypeScript
- Estrellas
- 665
- Forks
- 69
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 13
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 quarto-dev/quarto
-
vscode
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
quarto-dev/quarto#1227 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug vscode
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
quarto-dev/quarto#1211 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
quarto-dev/quarto#1139 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
quarto-dev/quarto#1138 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
quarto-dev/quarto#1137 ·
Los mantenedores suelen responder en 1 día
Todos los issues de quarto-dev/quarto
Issues similares
-
MCP tool results drop structuredContent when text is only a summaryPosiblemente ocupada @Pankaj-bit361 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
n8n-io/nod#1474 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Clean-up indicator: two polish points from the dev look (kit clock spacing, row description)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
inblockio/siwx-oidc-matrix-server#101 ·
Los mantenedores suelen responder en 1 día
-
status:needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pingdotgg/t3code#42253 · 1 comentario ·
Los mantenedores suelen responder en 1 día