microsoft / microsoft/TypeScript

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

Open
#63,463 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: LS: Completion Lists
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the completion path described in the issue and the generic FunctionLikeBodyKeywords filtering path. Read tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts and tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts, then use the linked Playground example to reproduce the completion. Done means default is absent in expression-bodied arrow function expression completions and the relevant fourslash coverage passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.