microsoft / microsoft/TypeScript

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

Aperta
#54,986 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando il comportamento di monitoraggio del file system di tsserver e la specifica collegata di Language Server Protocol per le notifiche di eliminazione dei file del workspace. Traccia il modo in cui l'eliminazione e la ridenominazione dei file raggiungono attualmente tsserver, quindi determina la gestione delle notifiche necessaria. Il lavoro è completato quando gli editor possono notificare tsserver tramite willDeleteFiles/didDeleteFiles e la relativa diagnostica rimane sincronizzata senza richiedere un riavvio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
devtools
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.