microsoft / microsoft/TypeScript

`default` keyword is offered in expression-bodied arrow function completions

オープン
#63,463 コメント 18 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Domain: LS: Completion Lists
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

## 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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue に記載された completion path と、汎用の FunctionLikeBodyKeywords filtering path から始めます。tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts と tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts を読み、その後、リンク先の Playground の例を使って completion を再現します。完了条件は、式本体のアロー関数式の completion に `default` が存在せず、関連する fourslash のカバレッジがパスすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。