microsoft / microsoft/TypeScript

Trivia ownership documentation seems to be incorrect

Aperta
#58,332 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment

Referencing the #1678 issue and the ast-trivia: trivia ownership in the typescript-book, there seems to be an error in explanation:

in the issue @mhegazy mentions:

one thing that is different from the Roslyn notion of trivia, is we do not have trailing trivia. all triva in TypeScript is leading. so for instance [...]

in the same issue and in the wiki book however the following info is given:

In General:

  • A token owns any trivia after it on the same line upto the next token.
  • Any comment after that line is associated with the following token.

So from the first cite I understand as if token owns any trivia before it up to the previous token ([trivia of A][token A]... that's why end-of-file token is always present) which seems to be the correct explanation, while the second cite describes that a token owns the trivia after it up to next token in the same line, which would mean that A has trailing trivia, thus not true in TS — albeit true for Roslyn.

[token A][trivia owned by A]<nl>
[trivia owned by B]
[token B]

Unless there is some misconception of what "owned" trivia means, but imo the second cite is incorrect.

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

Apri docs/compiler/ast-trivia.md alla sezione “trivia ownership” e confrontane la formulazione con l’issue #1678 e il comportamento di TypeScript citato. Aggiorna la spiegazione in modo che la proprietà sia coerente con il modello di trivia iniziale descritto nell’issue, quindi verifica che gli esempi inclusi non implichino più trivia finali.

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

Valutazione

Stack tecnologico
typescript
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
1/5
Tempo stimato
Meno di un'ora
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.