Skip to content

REPL Tab Completion Shows Duplicate Property Names #27516

@HK-SHAO

Description

@HK-SHAO

What version of Bun is running?

1.3.10

What platform is your computer?

Darwin 25.3.0 arm64 arm

What steps can reproduce the bug?

  1. Open a terminal and start the Bun REPL:

    bun repl
  2. Enter an empty object literal and press Tab to trigger autocomplete:

    {}.to[TAB]
  3. Observe the completion suggestions that appear in the terminal.

What is the expected behavior?

When using tab completion in the REPL, each property name should appear only once in the completion list. For example, when completing {}.to, the suggestions should be:

toString
toLocaleString

Each unique property name should be displayed exactly once, regardless of how many times it appears in the prototype chain.

What do you see instead?

Instead of unique property names, the completion list shows duplicate entries:

toString
toLocaleString
toString
toLocaleString

Additional information

The same property names are repeated multiple times because they appear at multiple levels in the JavaScript prototype chain (e.g., toString exists in both Function.prototype and Object.prototype), and the current implementation doesn't filter out duplicates when collecting completion suggestions from the prototype chain.

This issue is particularly noticeable when working with:

  • Empty objects {}
  • Functions or class instances
  • Objects with deep prototype chains

The duplicate entries clutter the completion list and make it harder to quickly identify and select the desired property name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions