microsoft / microsoft/TypeScript

Async LanguageServiceHost

Aperta
#29,361 7 commenti 17 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Domain: API In Discussion Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Search Terms

language, service, host, async, api

Suggestion

It'd super awesome if Language Service would accept a LanguageServiceHost with async API

Use Cases

Using LanguageService in environments where readFileSync is not available like browsers (using browserfs package or fs provided by WebSockets)

I'm working on an app like CodeSandbox but a bit more sophisticated.

Examples

class Host implements ts.LanguageServiceHost {
  async getScriptSnapshot(filename: string): Promise<ts.IScriptSnapshot> { }
  async readFile(filename: string): Promise<string> {}
}

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, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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 con le API LanguageServiceHost e LanguageService descritte nell’issue, confrontando le loro attuali assunzioni sincrone con gli esempi asincroni di getScriptSnapshot e readFile. Determina il design dell’API necessario per gli ambienti browser in cui readFileSync non è disponibile; il lavoro è completato quando è possibile usare un host asincrono senza interrompere il codice TypeScript o JavaScript esistente.

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

Valutazione

Stack tecnologico
typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.