repl: dynamically lookup the require extensions for tab complete

Removes 2 TODO items
pull/24504/head
Nathan Rajlich 2012-10-07 11:27:14 -07:00
parent 621caa7bc5
commit 7611c7cd25
1 changed files with 1 additions and 5 deletions

View File

@ -454,11 +454,7 @@ REPLServer.prototype.complete = function(line, callback) {
completionGroupsLoaded();
} else if (match = line.match(requireRE)) {
// require('...<Tab>')
//TODO: suggest require.exts be exposed to be introspec registered
//extensions?
//TODO: suggest include the '.' in exts in internal repr: parity with
//`path.extname`.
var exts = ['.js', '.node'];
var exts = Object.keys(require.extensions);
var indexRe = new RegExp('^index(' + exts.map(regexpEscape).join('|') +
')$');