Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature request: Autocomplete filenames for fs functions in repl #17764

Closed
not-an-aardvark opened this issue Dec 19, 2017 · 5 comments
Closed
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@not-an-aardvark
Copy link
Contributor

  • Version: 9.2.1
  • Platform: macOS Sierra
  • Subsystem: repl

If I type the following code into the repl, and then press tab, a list of autocomplete suggestions appears for the require-able files in the current directory:

require('./

It would be nice if a similar thing would happen when calling methods like fs.readFileSync. Specifically, after typing the following code, I would want the REPL to autocomplete with all existing files in the current directory:

fs.readFileSync('./

This would be useful when using the REPL to process/view a file.

@not-an-aardvark not-an-aardvark added feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem. labels Dec 19, 2017
@starkwang
Copy link
Contributor

starkwang commented Dec 20, 2017

+1 on it. But there is a little difficulty to implement 100% of the feature.

Now we are using regular expression to match the code we want to autocomplete. It's easy to match something like fs.someMethod('./

But consider the following in REPL:

> var { readFileSync } = require('fs');
> readFileSync('./

Or even odder:

> var { readFileSync: foo } = require('fs');
> foo('./

We cannot use a single regular expression to match these. The most direct way is to match all the strings starting with ./ or ../.

But is it worth to do it?

@benjamingr
Copy link
Member

@starkwang I'm fine with only solving this for people explicitly typing fs.someMethodSync( followed by a string literal of some sort (',", or `)

@bnoordhuis
Copy link
Member

Just noting that auto-completion of file names in large directories will freeze the REPL until #15699 is resolved.

Bamieh added a commit to Bamieh/node that referenced this issue Dec 20, 2017
@BridgeAR
Copy link
Member

This should now be unblocked by #22020.

@antsmartian
Copy link
Contributor

Fixed in #26648

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants