microsoft / microsoft/TypeScript
`default` keyword is offered in expression-bodied arrow function completions
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
## Bug Report
### Search Terms
- arrow function completion
- default keyword completion
- expression-bodied arrow function
- keyword completions
- completionListAtEndOfWordInArrowFunction
### Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about keyword completions in expression-bodied arrow function contexts.
### Playground Link
Playground link with relevant code: https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA
### Code
```ts
(d, defaultIsAnInvalidParameterName) => d
(d, defaultIsAnInvalidParameterName) => default
```
### Actual behavior
At the expression-bodied arrow function completion position, `default` is offered as a keyword completion.
### Expected behavior
`default` should not appear as a keyword completion in expression-bodied arrow function expression context.
### Additional information about the issue
There are already nearby fourslash tests that appear to acknowledge this behavior as undesirable:
- `tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts`
- `tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts`
I also traced the completion path locally and confirmed the keyword currently comes from the generic `FunctionLikeBodyKeywords` filtering path.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem im Issue beschriebenen Completion-Pfad und dem generischen Filterpfad für FunctionLikeBodyKeywords. Lies tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts und tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts und verwende dann das verknüpfte Playground-Beispiel, um die Completion zu reproduzieren. Erledigt ist die Aufgabe, wenn `default` in den Completions von Arrow-Function-Ausdrücken mit Expression Body fehlt und die relevanten fourslash-Tests bestehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 68/100