GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — repl: disable blocking completions by default · nodejs/node@1ac07b2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • repl.js
  • test/parallel
    • test-repl-tab-complete.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/repl.js‎

Copy file name to clipboardExpand all lines: lib/repl.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const {
5858
Promise,
5959
PromiseRace,
6060
RegExp,
61+
RegExpPrototypeTest,
6162
Set,
6263
StringPrototypeCharAt,
6364
StringPrototypeIncludes,
@@ -267,6 +268,7 @@ function REPLServer(prompt,
267268
configurable: true
268269
});
269270

271+
this.allowBlockingCompletions = !!options.allowBlockingCompletions;
270272
this.useColors = !!options.useColors;
271273
this._domain = options.domain || domain.create();
272274
this.useGlobal = !!useGlobal;
@@ -1186,7 +1188,8 @@ function complete(line, callback) {
11861188
if (completeOn.length) {
11871189
filter = completeOn;
11881190
}
1189-
} else if (requireRE.test(line)) {
1191+
} else if (RegExpPrototypeTest(requireRE, line) &&
1192+
this.allowBlockingCompletions) {
11901193
// require('...<Tab>')
11911194
const extensions = ObjectKeys(this.context.require.extensions);
11921195
const indexes = extensions.map((extension) => `index${extension}`);
@@ -1244,7 +1247,8 @@ function complete(line, callback) {
12441247
if (!subdir) {
12451248
completionGroups.push(_builtinLibs);
12461249
}
1247-
} else if (fsAutoCompleteRE.test(line)) {
1250+
} else if (RegExpPrototypeTest(fsAutoCompleteRE, line) &&
1251+
this.allowBlockingCompletions) {
12481252
[completionGroups, completeOn] = completeFSFunctions(line);
12491253
// Handle variable member lookup.
12501254
// We support simple chained expressions like the following (no function
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-repl-tab-complete.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ function getNoResultsFunction() {
5151

5252
const works = [['inner.one'], 'inner.o'];
5353
const putIn = new ArrayStream();
54-
const testMe = repl.start('', putIn);
54+
const testMe = repl.start({
55+
prompt: '',
56+
input: putIn,
57+
output: process.stdout,
58+
allowBlockingCompletions: true
59+
});
5560

5661
// Some errors are passed to the domain, but do not callback
5762
testMe._domain.on('error', assert.ifError);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.