Skip to content

Tab complete paths for `fs` functions in repl

Adds autocomplete in repl for fs methods that lookup file paths. Closes #17764 (closed)

  1. Tab complete only works for relative paths (this approach made most sense for me)
  2. The fs module must be explicitly accessed by fs.
var myFS = require('fs');
myFS.readFile('...<Tab>' // will not work
  1. I was afraid to refactor the require('...<Tab>') completion into a separate function and call it in both the require and fs.<method>, this would tidy up the code a little. I am willing to refactor it if I get a green light.

  2. I have the methods readlink and readlinkSync in the supported tab complete methods. I am not sure if these make sense to be added, or need a special lookup for only symlinks.

P.S. Implementing a feature to track all the variables defined for tab completion would benefit the repl tab completion in two folds:

  1. the tab completion will be smarter to know which variable refers to the fs module.
  2. all definitions (const and let) will be supported in the tab completion.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

repl

Merge request reports

Loading