getLeadingCommentRanges misses comment in call expression
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- compilers
Direzione di ricerca
Riproduci il problema con ts.getLeadingCommentRanges su console.log(/* hello */ "world") all’offset 12, quindi traccia il percorso iterateCommentRanges utilizzato da getLeadingCommentRanges. Il lavoro è completato quando la chiamata restituisce l’intervallo di commento previsto per il literal stringa senza introdurre regressioni nella gestione correlata dei commenti iniziali o finali.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Report
getLeadingCommentRanges misses comments that are in front of arguments passed to a call expression.
Comments being missed is a known issue when comments are within a node between tokens not stored in the tree: https://github.com/Microsoft/TypeScript/wiki/FAQ#why-some-comments-are-not-preserved-in-emitted-javascript-even-when---removecomments-is-not-specified
However that is not the case here and in fact tsc will preserve that particular comment.
Note: here I refer to getLeadingCommentRanges but in reality the bug is present inside of iterateCommentRanges (what getLeadingCommentRanges uses under the hood)
🔎 Search Terms
- leading, trailing comment undefined
- getLeadingCommentRanges, getTrailingCommentRanges
- Call expression, function call, method call
🕗 Version & Regression Information
- This is the behavior in every version I tried (
4.3.5(the oldest version on ts-ast-viewer.com),5.1.6,@next (5.2.0-dev.20230706))
⏯ Playground Link
https://ts-ast-viewer.com/#code/MYewdgziA2CmB00QHMAUB6AVAAgBa2iW03WwCIB3EAJ2gBMyBKIA
💻 Code
console.log(/* hello */ "world")
Calling getLeadingCommentRanges on the string literal returns undefined.
🙁 Actual behavior
ts.getLeadingCommentRanges('console.log(/* hello */ "world")', 12)
returns undefined
🙂 Expected behavior
ts.getLeadingCommentRanges('console.log(/* hello */ "world")', 12)
returns [ { kind: 3, start: 12, end: 23, hasTrailingNewLine: false } ]
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/TypeScript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
microsoft/TypeScript#64322 · 2 commenti · 1 reazione · 2 assegnatari ·
-
Possible Improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/TypeScript#64278 · 1 commento · 1 reazione ·
-
Docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
microsoft/TypeScript#64118 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
microsoft/TypeScript#64094 ·
-
Docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/TypeScript#63959 · 5 commenti ·
Tutte le issue di microsoft/TypeScript
Issue simili
-
optimization optimization:agents-md-curator
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
blinklabs-io/bursa#904 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 commenti ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100