Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ function complete(line, callback) {
var completions;
// List of completion lists, one for each inheritance "level"
var completionGroups = [];
var completeOn, i, group, c;
var completeOn, group, c;

// REPL commands (e.g. ".break").
var filter;
Expand All @@ -1112,7 +1112,7 @@ function complete(line, callback) {
completeOn = match[1];
var subdir = match[2] || '';
filter = match[1];
var dir, files, f, name, base, ext, abs, subfiles, s, isDirectory;
var dir, files, name, base, ext, abs, subfiles, isDirectory;
group = [];
let paths = [];

Expand All @@ -1126,14 +1126,14 @@ function complete(line, callback) {
paths = module.paths.concat(CJSModule.globalPaths);
}

for (i = 0; i < paths.length; i++) {
for (let i = 0; i < paths.length; i++) {
dir = path.resolve(paths[i], subdir);
try {
files = fs.readdirSync(dir);
} catch {
continue;
}
for (f = 0; f < files.length; f++) {
for (let f = 0; f < files.length; f++) {
name = files[f];
ext = path.extname(name);
base = name.slice(0, -ext.length);
Expand All @@ -1154,7 +1154,7 @@ function complete(line, callback) {
} catch {
continue;
}
for (s = 0; s < subfiles.length; s++) {
for (let s = 0; s < subfiles.length; s++) {
if (indexRe.test(subfiles[s])) {
group.push(subdir + name);
}
Expand Down Expand Up @@ -1291,7 +1291,7 @@ function complete(line, callback) {
}

if (memberGroups.length) {
for (i = 0; i < memberGroups.length; i++) {
for (let i = 0; i < memberGroups.length; i++) {
completionGroups.push(
memberGroups[i].map((member) => `${expr}.${member}`));
}
Expand All @@ -1316,7 +1316,7 @@ function complete(line, callback) {
// Filter, sort (within each group), uniq and merge the completion groups.
if (completionGroups.length && filter) {
var newCompletionGroups = [];
for (i = 0; i < completionGroups.length; i++) {
for (let i = 0; i < completionGroups.length; i++) {
group = completionGroups[i]
.filter((elem) => elem.indexOf(filter) === 0);
if (group.length) {
Expand All @@ -1332,7 +1332,7 @@ function complete(line, callback) {
// Completion group 0 is the "closest"
// (least far up the inheritance chain)
// so we put its completions last: to be closest in the REPL.
for (i = 0; i < completionGroups.length; i++) {
for (let i = 0; i < completionGroups.length; i++) {
group = completionGroups[i];
group.sort();
for (var j = group.length - 1; j >= 0; j--) {
Expand Down