Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c8e9adb

Browse filesBrowse files
princejwesleyMyles Borins
authored andcommitted
repl: fix tab completion for defined commands
PR-URL: #7364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent 71ef71c commit c8e9adb
Copy full SHA for c8e9adb

File tree

Expand file treeCollapse file tree

2 files changed

+9
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-2
lines changed
Open diff view settings
Collapse file

‎lib/repl.js‎

Copy file name to clipboardExpand all lines: lib/repl.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,11 @@ REPLServer.prototype.complete = function(line, callback) {
659659

660660
// REPL commands (e.g. ".break").
661661
var match = null;
662-
match = line.match(/^\s*(\.\w*)$/);
662+
match = line.match(/^\s*\.(\w*)$/);
663663
if (match) {
664664
completionGroups.push(Object.keys(this.commands));
665665
completeOn = match[1];
666-
if (match[1].length > 1) {
666+
if (match[1].length) {
667667
filter = match[1];
668668
}
669669

Collapse file

‎test/parallel/test-repl-tab-complete.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-repl-tab-complete.js
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,10 @@ putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']);
306306
testMe.complete('obj.', common.mustCall(function(error, data) {
307307
assert.deepEqual(data, obj_elements);
308308
}));
309+
310+
// tab completion for defined commands
311+
putIn.run(['.clear']);
312+
313+
testMe.complete('.b', common.mustCall((error, data) => {
314+
assert.deepStrictEqual(data, [['break'], 'b']);
315+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.