| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7bc2f06 commit 596dd9f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1005,6 +1005,7 @@ ArrayStream.prototype.resume = function() {}; | |||
| 1005 | 1005 | ArrayStream.prototype.write = function() {}; | |
| 1006 | 1006 | ||
| 1007 | 1007 | const requireRE = /\brequire\s*\(['"](([\w@./-]+\/)?(?:[\w@./-]*))/; | |
| 1008 | + const fsAutoCompleteRE = /fs(?:\.promises)?\.\s*[a-z][a-zA-Z]+\(\s*["'](.*)/; | ||
| 1008 | 1009 | const simpleExpressionRE = | |
| 1009 | 1010 | /(?:[a-zA-Z_$](?:\w|\$)*\.)*[a-zA-Z_$](?:\w|\$)*\.?$/; | |
| 1010 | 1011 | ||
@@ -1173,7 +1174,7 @@ function complete(line, callback) { | |||
| 1173 | 1174 | } | |
| 1174 | 1175 | ||
| 1175 | 1176 | completionGroupsLoaded(); | |
| 1176 | - } else if (match = line.match(/fs\.\s*[a-z][a-zA-Z]+\(\s*["'](.*)/)) { | ||
| 1177 | + } else if (match = line.match(fsAutoCompleteRE)) { | ||
| 1177 | 1178 | ||
| 1178 | 1179 | let filePath = match[1]; | |
| 1179 | 1180 | let fileList; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -402,37 +402,39 @@ testMe.complete('obj.', common.mustCall((error, data) => { | |||
| 402 | 402 | putIn.run(['.clear']); | |
| 403 | 403 | process.chdir(__dirname); | |
| 404 | 404 | ||
| 405 | - const readFileSync = 'fs.readFileSync("'; | ||
| 406 | - const fixturePath = `${readFileSync}../fixtures/test-repl-tab-completion`; | ||
| 405 | + const readFileSyncs = ['fs.readFileSync("', 'fs.promises.readFileSync("']; | ||
| 407 | 406 | if (!common.isWindows) { | |
| 408 | - testMe.complete(fixturePath, common.mustCall((err, data) => { | ||
| 409 | - assert.strictEqual(err, null); | ||
| 410 | - assert.ok(data[0][0].includes('.hiddenfiles')); | ||
| 411 | - assert.ok(data[0][1].includes('hellorandom.txt')); | ||
| 412 | - assert.ok(data[0][2].includes('helloworld.js')); | ||
| 413 | - })); | ||
| 407 | + readFileSyncs.forEach((readFileSync) => { | ||
| 408 | + const fixturePath = `${readFileSync}../fixtures/test-repl-tab-completion`; | ||
| 409 | + testMe.complete(fixturePath, common.mustCall((err, data) => { | ||
| 410 | + assert.strictEqual(err, null); | ||
| 411 | + assert.ok(data[0][0].includes('.hiddenfiles')); | ||
| 412 | + assert.ok(data[0][1].includes('hellorandom.txt')); | ||
| 413 | + assert.ok(data[0][2].includes('helloworld.js')); | ||
| 414 | + })); | ||
| 414 | 415 | ||
| 415 | - testMe.complete(`${fixturePath}/hello`, | ||
| 416 | - common.mustCall((err, data) => { | ||
| 417 | - assert.strictEqual(err, null); | ||
| 418 | - assert.ok(data[0][0].includes('hellorandom.txt')); | ||
| 419 | - assert.ok(data[0][1].includes('helloworld.js')); | ||
| 420 | - }) | ||
| 421 | - ); | ||
| 422 | - | ||
| 423 | - testMe.complete(`${fixturePath}/.h`, | ||
| 424 | - common.mustCall((err, data) => { | ||
| 425 | - assert.strictEqual(err, null); | ||
| 426 | - assert.ok(data[0][0].includes('.hiddenfiles')); | ||
| 427 | - }) | ||
| 428 | - ); | ||
| 429 | - | ||
| 430 | - testMe.complete(`${readFileSync}./xxxRandom/random`, | ||
| 431 | - common.mustCall((err, data) => { | ||
| 432 | - assert.strictEqual(err, null); | ||
| 433 | - assert.strictEqual(data[0].length, 0); | ||
| 434 | - }) | ||
| 435 | - ); | ||
| 416 | + testMe.complete(`${fixturePath}/hello`, | ||
| 417 | + common.mustCall((err, data) => { | ||
| 418 | + assert.strictEqual(err, null); | ||
| 419 | + assert.ok(data[0][0].includes('hellorandom.txt')); | ||
| 420 | + assert.ok(data[0][1].includes('helloworld.js')); | ||
| 421 | + }) | ||
| 422 | + ); | ||
| 423 | + | ||
| 424 | + testMe.complete(`${fixturePath}/.h`, | ||
| 425 | + common.mustCall((err, data) => { | ||
| 426 | + assert.strictEqual(err, null); | ||
| 427 | + assert.ok(data[0][0].includes('.hiddenfiles')); | ||
| 428 | + }) | ||
| 429 | + ); | ||
| 430 | + | ||
| 431 | + testMe.complete(`${readFileSync}./xxxRandom/random`, | ||
| 432 | + common.mustCall((err, data) => { | ||
| 433 | + assert.strictEqual(err, null); | ||
| 434 | + assert.strictEqual(data[0].length, 0); | ||
| 435 | + }) | ||
| 436 | + ); | ||
| 437 | + }); | ||
| 436 | 438 | } | |
| 437 | 439 | } | |
| 438 | 440 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments