diff options
author | antsmartian <anto.aravinth.cse@gmail.com> | 2019-09-09 21:33:10 +0530 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-09-15 21:45:41 -0700 |
commit | ed0e5c8c744439c759343030bd429bc514aef5c0 (patch) | |
tree | 5ba8cfb75a3a1353b7f05e46af3641d1e2dd3fd4 /lib | |
parent | 5de1052dc9253ef7d9bbfb3e620e60cfbf7081b5 (diff) | |
download | android-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.js | 3 |
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; |