microsoft / microsoft/TypeScript

Completion should suggest enum keys on some conditions

Open
#60,184 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: LS: Completion Lists Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔍 Search Terms

"enum", "enum keys", "completion"

✅ Viability Checklist
⭐ Suggestion

Suggest enum keys completions without having to spell out the enum identifier.

For example, input CRE should be offered completion State.CREATED.

This completion can be limited to places where the enum type is expected, like a function argument or an object literal.

📃 Motivating Example
enum State {
    CREATED,
    CLOSED,
}

function f(v : State) {}

f(CRE ) // Expect completion on CRE
💻 Use Cases
  1. What do you want to use this for? better DX
  2. What shortcomings exist with current approaches? Have to first write the enum before enum key completions are offered.
  3. What workarounds are you using in the meantime? no

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

No file, test, or entry point is named. Start by reproducing the enum completion example in the TypeScript language service and trace how completions are filtered in type-expected contexts. Done means a prefix such as CRE offers State.CREATED without requiring the enum identifier first, while preserving existing JavaScript output and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.