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

Interactive REPL Interface #5

Open
3 of 10 tasks
nixpulvis opened this issue Jul 23, 2018 · 7 comments
Open
3 of 10 tasks

Interactive REPL Interface #5

nixpulvis opened this issue Jul 23, 2018 · 7 comments
Labels
L: design Designs, ideas and questions with tangible goals L1: enhancement New feature or request L2: good first issue Good for newcomers M: repl Module: Our own Read Eval Print Loop, like `readline` T: io Topic: Input and output related issues
Milestone

Comments

@nixpulvis
Copy link
Owner

nixpulvis commented Jul 23, 2018

In addition to the basic support for reading programs from a non-interactive input, we need to have the ability to run in interactive mode, with prompts, and the full suite of features.

Modern

Open Questions

  • Mouse?
@nixpulvis
Copy link
Owner Author

I want to move all stream processing out of main.rs and into the fancy new repl module. I believe BufReadDecoder will be needed.

@nixpulvis
Copy link
Owner Author

So here's an idea (does lalrpop support it?), we return a parse error on incomplete syntax, and that's the input to the function that drives highlighting, completion, history selection, etc.

As such it'll need to be an AST of the syntax so far, and some expected set. The parser must be somewhat performant to do this on each action in raw mode, we may need to buffer by token or some larger piece of grammar. This should be easy-ish by using one of the composite grammars from the LALRPOP generated parsers.

@nixpulvis nixpulvis added this to the POSIX milestone Oct 15, 2018
@nixpulvis nixpulvis added the L1: enhancement New feature or request label Oct 15, 2018
@nixpulvis nixpulvis modified the milestones: POSIX, Modern Oct 16, 2018
@nixpulvis nixpulvis added T: io Topic: Input and output related issues L2: good first issue Good for newcomers L: design Designs, ideas and questions with tangible goals and removed question labels Oct 16, 2018
@nixpulvis
Copy link
Owner Author

The initial sh style completion feature will be simple and fast enough to run inline, but after that point a more robust asynchronous implementation is needed.

@do-you-dare
Copy link
Contributor

What would the mouse features be? Asking just out of curiosity :p
By the way, nice project!

@nixpulvis
Copy link
Owner Author

@dread-uo I've been so busy writing all this POSIX stuff I haven't thought much about it. I spent a good part of tonight working on making the raw terminal mode a cargo feature... mouse actions could go on top of that.

Looking at MouseEvent looks like we get everything we'd need. Terminals are netoriously known for not being heavy on mouse interactions, but I think there are a few nice things we could try. As a general rule of thumb, mouse actions should be things you are doing not as part of a normal text REPL workflow. For example a mouse button to close a search mode would make me cry.

  1. I already have dreams of a mode that operates like a shared tmux session, perhaps the mouse could show up as a colored cursor on the other persons terminal window.
  2. While many terminal emulators support clicking links and things like that, we could have our own logic, and include more kinds of links.
  3. There's something really interesting about having shell ASTs and the ability to click the syntax, maybe something like https://explainshell.com/ could be made to work well.

Basically who knows at this point. Thanks for the question. Let me know if you end up using the shell at all, or want to help 😉

@nixpulvis
Copy link
Owner Author

nixpulvis commented Oct 20, 2018

In order to support current and future needs for completion, here is a more complete design.

  • complete (combine the below functions)
  • complete_command
    • complete_builtin
    • complete_function
    • complete_executable
  • complete_path (includes ~, and globs)
  • complete_variable
  • complete_job
  • complete_syntax
enum Completion {
    None,
    Partial(String, HashSet<String>),
    Complete(String),
}

Still need to figure out the best place to put the completion for the fish style last history completion.

@nixpulvis nixpulvis mentioned this issue Oct 22, 2018
6 tasks
@nixpulvis
Copy link
Owner Author

A good list of features to support to be inline with sh can be found here under the section "Command Line Editing".

@nixpulvis nixpulvis added M: repl Module: Our own Read Eval Print Loop, like `readline` and removed L2: good first issue Good for newcomers labels Aug 10, 2021
@nixpulvis nixpulvis added the L2: good first issue Good for newcomers label Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: design Designs, ideas and questions with tangible goals L1: enhancement New feature or request L2: good first issue Good for newcomers M: repl Module: Our own Read Eval Print Loop, like `readline` T: io Topic: Input and output related issues
Projects
None yet
Development

No branches or pull requests

2 participants