Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: add autocomplete for filesystem modules #26648

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
7 participants
@antsmartian
Copy link
Contributor

commented Mar 14, 2019

This is a implementation of: #17764

There are other few things to be done like handling autocompletion for filenames etc.
Marking it as WIP. But would love to get feedback from @nodejs/repl

Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved lib/repl.js Outdated

@antsmartian antsmartian force-pushed the antsmartian:add_filelist_tab branch from bc9a014 to d4fec28 Mar 20, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Mar 20, 2019

@antsmartian antsmartian force-pushed the antsmartian:add_filelist_tab branch from d4fec28 to 20e96d1 Mar 20, 2019

@antsmartian antsmartian changed the title (WIP) repl: add autocomplete for filesystem modules repl: add autocomplete for filesystem modules Mar 20, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Mar 20, 2019

@antsmartian antsmartian force-pushed the antsmartian:add_filelist_tab branch from 20e96d1 to 76b01ec Mar 22, 2019

Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved test/parallel/test-repl-tab-complete.js Outdated
@BridgeAR
Copy link
Member

left a comment

This is overall looking very promising. I believe this should be good to go after addressing my comments.

Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved lib/repl.js Outdated
Show resolved Hide resolved test/parallel/test-repl-tab-complete.js Outdated

@antsmartian antsmartian force-pushed the antsmartian:add_filelist_tab branch from 76b01ec to 8b666b2 Apr 20, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Apr 20, 2019

@BridgeAR Thanks much for the follow up and I'm sorry for being late here. I have fixed up the comments, could you please have a look at them?

@BridgeAR
Copy link
Member

left a comment

LGTM with my comment addressed.

Show resolved Hide resolved lib/repl.js Outdated

@antsmartian antsmartian force-pushed the antsmartian:add_filelist_tab branch from 8b666b2 to b8cebd3 Apr 21, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Apr 21, 2019

@BridgeAR Have fixed your comments, PTAL.

@BridgeAR
Copy link
Member

left a comment

LGTM. I found one more small thing that won't change the behavior but filter should always be a string or undefined. Using false adds another map (internal V8 type, also called hidden class) to it.

Thanks for following up on the comments!

lib/repl.js Outdated

let filePath = match[1];
let fileList;
filter = false;

This comment has been minimized.

Copy link
@BridgeAR

BridgeAR Apr 21, 2019

Member
Suggested change
filter = false;
filter = '';
@nodejs-github-bot

This comment has been minimized.

@antsmartian antsmartian force-pushed the antsmartian:add_filelist_tab branch from b8cebd3 to 01102c4 Apr 25, 2019

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2019

@BridgeAR @nodejs/repl PTAL.. Thanks!

@nodejs-github-bot

This comment has been minimized.

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Apr 27, 2019

@nodejs/repl Can I get one more review, please. Planning to land by April 29th if there are no objections.

@nodejs-github-bot

This comment has been minimized.

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Apr 27, 2019

@BridgeAR I have addressed your comments regarding filter, PTAL and see if its looks good.. Thanks!

@BridgeAR

This comment has been minimized.

Copy link
Member

commented Apr 27, 2019

Still LGTM

@antsmartian

This comment has been minimized.

Copy link
Contributor Author

commented Apr 29, 2019

Landed in d69f004 🎉

@antsmartian antsmartian deleted the antsmartian:add_filelist_tab branch Apr 29, 2019

antsmartian added a commit that referenced this pull request Apr 29, 2019

repl: add autocomplete for filesystem modules
PR-URL: #26648
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

targos added a commit that referenced this pull request Apr 29, 2019

repl: add autocomplete for filesystem modules
PR-URL: #26648
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

@targos targos referenced this pull request May 6, 2019

Merged

v12.2.0 proposal #27578

targos added a commit that referenced this pull request May 7, 2019

2019-05-07, Version 12.2.0 (Current)
Notable changes:

* deps:
  * Updated llhttp to 1.1.3. This fixes a bug that made Node.js' HTTP
    parser refuse any request URL that contained the "|" (vertical bar)
    character. #27595
* tls:
  * Added an `enableTrace()` method to `TLSSocket` and an `enableTrace`
    option to `tls.createServer()`. When enabled, TSL packet trace
    information is written to `stderr`. This can be used to debug TLS
    connection problems. #27497
    #27376
* cli:
  * Added a `--trace-tls` command-line flag that enables tracing of TLS
    connections without the need to modify existing application code.
    #27497
  * Added a `--cpu-prof-interval` command-line flag. It can be used to
    specify the sampling interval for the CPU profiles generated by
    `--cpu-prof`. #27535
* module:
  * Added the `createRequire()` method. It allows to create a require
    function from a file URL object, a file URL string or an absolute
    path string. The existing `createRequireFromPath()` method is now
    deprecated #27405.
  * Throw on `require('./path.mjs')`. This is technically a breaking
    change that should have landed with Node.js 12.0.0. It is necessary
    to have this to keep the possibility for a future minor version to
    load ES Modules with the require function.
    #27417
* repl:
  * The REPL now supports multi-line statements using `BigInt` literals
    as well as public and private class fields and methods.
    #27400
  * The REPL now supports tab autocompletion of file paths with `fs`
    methods. #26648
* meta:
  * Added Christian Clauss (https://github.com/cclauss) to
    collaborators. #27554

PR-URL: #27578

targos added a commit that referenced this pull request May 7, 2019

2019-05-07, Version 12.2.0 (Current)
Notable changes:

* deps:
  * Updated llhttp to 1.1.3. This fixes a bug that made Node.js' HTTP
    parser refuse any request URL that contained the "|" (vertical bar)
    character. #27595
* tls:
  * Added an `enableTrace()` method to `TLSSocket` and an `enableTrace`
    option to `tls.createServer()`. When enabled, TSL packet trace
    information is written to `stderr`. This can be used to debug TLS
    connection problems. #27497
    #27376
* cli:
  * Added a `--trace-tls` command-line flag that enables tracing of TLS
    connections without the need to modify existing application code.
    #27497
  * Added a `--cpu-prof-interval` command-line flag. It can be used to
    specify the sampling interval for the CPU profiles generated by
    `--cpu-prof`. #27535
* module:
  * Added the `createRequire()` method. It allows to create a require
    function from a file URL object, a file URL string or an absolute
    path string. The existing `createRequireFromPath()` method is now
    deprecated #27405.
  * Throw on `require('./path.mjs')`. This is technically a breaking
    change that should have landed with Node.js 12.0.0. It is necessary
    to have this to keep the possibility for a future minor version to
    load ES Modules with the require function.
    #27417
* repl:
  * The REPL now supports multi-line statements using `BigInt` literals
    as well as public and private class fields and methods.
    #27400
  * The REPL now supports tab autocompletion of file paths with `fs`
    methods. #26648
* meta:
  * Added Christian Clauss (https://github.com/cclauss) to
    collaborators. #27554

PR-URL: #27578
@rauschma

This comment has been minimized.

Copy link

commented May 18, 2019

Small bug on macOS (when, e.g., in /Users/rauschma):

fs.readFileSync('Pub<tab>

EXPECTED: fs.readFileSync('Public
ACTUAL:   fs.readFileSync('Pubublic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.