fzyzcjy / dart_interactive

REPL (interactive shell) for Dart, supporting 3rd party packages, hot reload, and full grammar
https://github.com/fzyzcjy/dart_interactive
MIT License
147 stars 12 forks source link

Don't use cli_repl anymore #61

Closed Keithcat1 closed 1 year ago

Keithcat1 commented 1 year ago

It not only forces you to use weird keystrokes instead of for example backspace, up / down ETC, but also silently breaks the normal ones in one way or another. If you ever noticed that pressing backspace would invalidate the line of code you're working on, this is why.

Also made line reading async so our isolate message handlers can run whenever instead of waiting for readLineSync() to finish.

fzyzcjy commented 1 year ago

Hmm I am not very sure. I know that one has some bugs, but by removing it, we are lacking more functionalities IMHO. If you find a bug of cli_repl, maybe we should create a PR there to fix it?

Keithcat1 commented 1 year ago

I don't think it does anything besides just reinventing all the old operations from looking at the source code.

fzyzcjy commented 1 year ago

reinventing all the old operations

May I know what is "all the old operations"?

Keithcat1 commented 1 year ago

It makes you use CTRL + some other keys instead of left and right to move back and forward on the line. Same with moving to the previous lines, and there isn't any way for someone who opens up the REPL to find that out. It also makes you use CTRL + D instead of backspace. The problems with this are that CTRL + D is also used to exit the REPL when there's no text on the current line so if you press it too fast or something, you could exit the REPL by mistake and lose the last five minutes of work. Also, if you press backspace, it will looklike it deleted the character as expected, but it actually inserts a U+008 character in the line because of the weird way that cli_repl handles things, and then when you perss enter to submit that line of code, it gives a weird error because Dart doesn't know how to handle tha special character.

fzyzcjy commented 1 year ago

Hmm I see. Could you please create an issue at https://github.com/jathak/cli_repl discussing with that package? Because IMHO cli_repl has some quite useful operations, such as quickly give previous commands, etc. So maybe the problems you mentioned above can be fixed there.

Keithcat1 commented 1 year ago

Normal windows terminal can also let you repeat the previous commands by pressing up arrow to select it and then enter.

fzyzcjy commented 1 year ago

Sure. The problem is, does it work inside this repl? b/c that is a terminal feature, while inside repl the >>> is no longer using the OS terminal feature.

Keithcat1 commented 1 year ago

This PR makes it use the normal terminal, so everything works as expected. I just tested it and going back to previous lines works.

fzyzcjy commented 1 year ago

Looks interesting! Could you please share a short video showing it? And does it work for all platforms (win, mac, linux)?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.