Skip to content

[repl] do not show all matches on first tab #7665

Closed

Description

@trevnorris
  • Version: All
  • Platform: All
  • Subsystem: REPL (shipped)

It's an annoyance that the REPL prints out all possibilities the first time hitting the tab. It would be much better if it simply autocompleted as much as possible and waited for a subsequent tab before printing out all matches. Here's an example usages:

> Bu<TAB>.al<TAB>U<TAB>S<TAB>

To produce Buffer.allocUnsafeSlow, but in doing so I get a screen filled with matches that I know I don't want.

Throwing this out there in case anyone wants to take care of it before I do (which I don't plan to in the near future).

Activity

  1. added
    replIssues and PRs related to the REPL subsystem.
    on Jul 11, 2016
  2. princejwesley commented on Jul 12, 2016

    @princejwesley
    Contributor

    @mscdex @trevnorris FYI, Its implemented for .editor mode (PR link). If .editor mode is good to go, I'll update PR to support least common prefix based tab completion for default mode.

  3. Fishrock123 commented on Jul 12, 2016

    @Fishrock123
    Contributor

    We should do this with or without .editor support.

  4. princejwesley commented on Jul 12, 2016

    @princejwesley
    Contributor

    yes, since editor mode PR has support for LCP Tab completion, I thought of modify it to support for all cases.

  5. silverwind commented on Jul 12, 2016

    @silverwind
    Contributor

    Would very much like this feature. We can probably re-use some code, because this works:

    > require('a<TAB>
    > require('assert
    
  6. trevnorris commented on Jul 12, 2016

    @trevnorris
    ContributorAuthor

    Ooh. How about automatic path searching? e.g. require('./foo<TAB> :)

  7. silverwind commented on Jul 12, 2016

    @silverwind
    Contributor

    How about automatic path searching?

    Already kind of works, but it wrongly expands require('./<TAB> to stuff inside node_modules.

    Oh, and adding to the wishlist for tab-completion, require('path').<TAB> could suggest all return properties from that function call.

  8. addaleax commented on Jul 12, 2016

    @addaleax
    Member

    Oh, and adding to the wishlist for tab-completion, require('path').<TAB> could suggest all return properties from that function call.

    That would be awesome, but these kind of things get really tricky, as require()ing a module can have side effects and tab completion never should have any.

  9. silverwind commented on Jul 13, 2016

    @silverwind
    Contributor

    side effects

    True, probably not worth the risk and hassle to implement something timeout-based.

  10. princejwesley commented on Jul 13, 2016

    @princejwesley
    Contributor

    Incorporated tab completion support in #7275

  11. added
    readlineIssues and PRs related to the built-in readline module.
    on Jul 15, 2016
  12. addaleax commented on Jul 15, 2016

    @addaleax
    Member

    PR for solving this on the readline level: #7754

  13. trevnorris commented on Aug 9, 2016

    @trevnorris
    ContributorAuthor

    Whoot! Thanks @addaleax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.readlineIssues and PRs related to the built-in readline module.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions