microsoft / microsoft/TypeScript

Add support for `willDeleteFiles`/`didDeleteFiles` to tsserver

Abierto
#54,986 0 comentarios 4 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Suggestion

🔍 Search Terms

willDeleteFiles/didDeleteFiles
update errors after deleting file
deleting file
removing file
renaming file

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Add support for willDeleteFiles/didDeleteFiles (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_willDeleteFiles)
As for my current knowledge, tsserver right now watches filesystem on its own, as mentioned in this article. Unfortunately this method is not always correct and sometimes (specifically in larger repositories) after renaming files, or deleting them - tsserver does not know that the filesystem was changed resulting in out-of-sync error messages.
Adding support for such methods would allow editors to notify tsserver that something has changed and then tsserver could internally update it's state about the files.

📃 Motivating Example

https://github.com/microsoft/TypeScript/assets/35625949/1eec8678-8af6-43d0-bf2f-25eecbac0b96

In this example, when file is deleted by the user, the diagnostic about file not existing is not shown. It might be shown after some time in the future, but an editor can send this notification to the server immediately after user performs an action

💻 Use Cases

For now the only way to deal with this is to restart tsserver. While this solution works it would be nicer user experience for this to happen automatically.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza revisando el comportamiento de supervisión del sistema de archivos de tsserver y la especificación vinculada de Language Server Protocol para las notificaciones de eliminación de archivos del workspace. Traza cómo llegan actualmente a tsserver la eliminación y el renombrado de archivos, y determina después el procesamiento de notificaciones necesario. Se considera completado cuando los editores pueden notificar a tsserver mediante willDeleteFiles/didDeleteFiles y sus diagnósticos permanecen sincronizados sin requerir un reinicio.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
devtools
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.