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

FR: CodeBlocks in REPL. #20817

Closed
hemanth opened this issue May 18, 2018 · 7 comments
Closed

FR: CodeBlocks in REPL. #20817

hemanth opened this issue May 18, 2018 · 7 comments
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@hemanth
Copy link
Contributor

hemanth commented May 18, 2018

$ node --version
v10.0.0

$ uname
Darwin LM-BNG-22004407 16.7.0 Darwin Kernel Version 16.7.0

So, today:

$ node

> obj = {
... 
... 
... }

# If we hit the up arrow key, we see
> }

> obj = {

Rather, if we could display the entire code block, when we do an up arrow, like:

$ node

> obj = {
... 
... 
... }

# If we hit the up arrow key, we must see

> obj = {}

This should make life on the REPL much easier.

Very similar to how devtool console treats code blocks.

@bnoordhuis bnoordhuis added repl Issues and PRs related to the REPL subsystem. feature request Issues that request new features to be added to Node.js. labels May 18, 2018
@bnoordhuis
Copy link
Member

I'm fairly sure this has been discussed before but I can't find the issue.

The problem with your suggestion is that you won't be able to edit code blocks anymore since the REPL is line-oriented. It's not a text editor where you can move up and down. (Not counting ed.)

@AyushG3112
Copy link
Contributor

AyushG3112 commented May 18, 2018

@bnoordhuis can't we trim the newlines from the code block to make sure that the block shows up on a single line? That's what the mongoDB REPL does, and is quite convenient.

@targos
Copy link
Member

targos commented May 18, 2018

Shells like bash or zsh can do that:

https://asciinema.org/a/lBGxcTTxXoGGhPmhARMAt0CsG

Is it an option for Node?

@bnoordhuis
Copy link
Member

bnoordhuis commented May 18, 2018

@AyushG3112 I don't think so. ASI means JS code with and without newlines doesn't necessarily behave the same.

@hemanth
Copy link
Contributor Author

hemanth commented May 20, 2018

Agree that we won't be able to edit it, but it would make this easier to tracking what was done, maybe we need to copy the block or we are demoing something on REPL...

@antsmartian
Copy link
Contributor

antsmartian commented Nov 4, 2018

This got fixed : #22153 and landed in master. Was surprised, I didn't notice this issue before (I saw the problem myself and fixed it :)). We can close this now.

@hemanth
Copy link
Contributor Author

hemanth commented Nov 4, 2018

@antsmartian Awesome! We can try this on nightly, I guess.

@Trott Trott closed this as completed Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

6 participants