summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorantsmartian <anto.aravinth.cse@gmail.com>2019-09-09 21:33:10 +0530
committerRich Trott <rtrott@gmail.com>2019-09-15 21:45:41 -0700
commited0e5c8c744439c759343030bd429bc514aef5c0 (patch)
tree5ba8cfb75a3a1353b7f05e46af3641d1e2dd3fd4 /lib
parent5de1052dc9253ef7d9bbfb3e620e60cfbf7081b5 (diff)
downloadandroid-node-v8-ed0e5c8c744439c759343030bd429bc514aef5c0.tar.gz
android-node-v8-ed0e5c8c744439c759343030bd429bc514aef5c0.tar.bz2
android-node-v8-ed0e5c8c744439c759343030bd429bc514aef5c0.zip
repl: add autocomplete support for fs.promises
PR-URL: https://github.com/nodejs/node/pull/29400 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/repl.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/repl.js b/lib/repl.js
index d3e9d4689c..0bcf0df324 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -1005,6 +1005,7 @@ ArrayStream.prototype.resume = function() {};
ArrayStream.prototype.write = function() {};
const requireRE = /\brequire\s*\(['"](([\w@./-]+\/)?(?:[\w@./-]*))/;
+const fsAutoCompleteRE = /fs(?:\.promises)?\.\s*[a-z][a-zA-Z]+\(\s*["'](.*)/;
const simpleExpressionRE =
/(?:[a-zA-Z_$](?:\w|\$)*\.)*[a-zA-Z_$](?:\w|\$)*\.?$/;
@@ -1173,7 +1174,7 @@ function complete(line, callback) {
}
completionGroupsLoaded();
- } else if (match = line.match(/fs\.\s*[a-z][a-zA-Z]+\(\s*["'](.*)/)) {
+ } else if (match = line.match(fsAutoCompleteRE)) {
let filePath = match[1];
let fileList;