microsoft / microsoft/TypeScript

Add structure to diagnostics to enable nicer diagnostic output and interactivity in tooling such as IDEs

Aperta
#57,180 6 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

🔍 Search Terms

diagnostics, interactive errors, structured diagnostics, error formatting

✅ Viability Checklist
⭐ Suggestion

change diagnostics to some structured data instead of plain strings. At its simplest this would be including an array of the sources for the text that populates the substitution variables in the diagnostic message strings. If we also keep a cache or recent sources and include a key into that cache in the diagnostic, then we can provide callback functionality for tools to get more information in both the TS api and tssserver.

📃 Motivating Example

IDEs can provide much richer displays for error messages and even add interactivity. Imagine having syntax highlighting for types or being able to click to "go to definition" in an error message.

A very rough proof of concept showing an enhancement to the problems view in VsCode

https://github.com/microsoft/TypeScript/assets/84949734/25f8366d-a94e-44fb-bfd2-9f204be96097

💻 Use Cases
  1. What do you want to use this for?
    a. Better display and interaction with error message
  2. What shortcomings exist with current approaches?
    a. Currently only possible by parsing error text.
    b. Advanced usages require traversing the AST to find the nodes and types that contribute to the error
  3. What workarounds are you using in the meantime?
    a. see 2.

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 diagnosi esposte tramite la TypeScript API e tssserver, quindi confronta le diagnosi attuali come semplici stringhe con i dati strutturati e le informazioni sulla sorgente proposti. Esamina come gli strumenti IDE analizzano attualmente i messaggi o attraversano l’AST; il lavoro è completo quando gli strumenti possono ottenere un contesto diagnostico più ricco e supportare visualizzazioni interattive senza modificare il comportamento di runtime esistente.

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

Valutazione

Stack tecnologico
typescript
Ambito
developer-experience, 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.