microsoft / microsoft/TypeScript
`default` keyword is offered in expression-bodied arrow function completions
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中描述的 completion 路径和通用的 FunctionLikeBodyKeywords 过滤路径开始。阅读 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