Tab complete paths for `fs` functions in repl
Adds autocomplete in repl
for fs
methods that lookup file paths. Closes #17764 (closed)
- Tab complete only works for relative paths (this approach made most sense for me)
- The
fs
module must be explicitly accessed byfs
.
var myFS = require('fs');
myFS.readFile('...<Tab>' // will not work
-
I was afraid to refactor the
require('...<Tab>')
completion into a separate function and call it in both therequire
andfs.<method>
, this would tidy up the code a little. I am willing to refactor it if I get a green light. -
I have the methods
readlink
andreadlinkSync
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:
- the tab completion will be smarter to know which variable refers to the fs module.
- all definitions (
const
andlet
) will be supported in the tab completion.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
repl