bhauman / rebel-readline

Terminal readline library for Clojure dialects
Eclipse Public License 1.0
680 stars 37 forks source link

parinfer #84

Open shaunlebron opened 6 years ago

shaunlebron commented 6 years ago

At the end of your quick demo, I saw a note about adding parinfer support:

user=> ;; paredit and parinfer will be next!                                                   
  #_=> ;; to be released in the near future!     

Proper parinfer integration into a REPL has not yet been tried!—though planck/lumo used it just to auto-indent new lines. So, I'm interested to see if fully making it work here would help the experience that you're going for.

Implementation-wise, Parinfer is just a pure function of your text/cursor that runs on every keystroke—fully replacing the old text/cursor with new text/cursor with inferred close-parens. I can see this being pretty simple to integrate into readline. Though it does need extra inputs like the size/position of the previous change and cursor position, I think these will be easy to deduce in the constrained context of readline.

We can use parinfer-jvm for a proof of concept, though the newer behavior will require us to update the library with the new algorithms. (@cursive-ide and @oakes are using some version of this library in their editors, and @timothypratley will possibly use it to build a code format validator.)

bhauman commented 6 years ago

Thanks for the info!

On my current roadmap is paredit first of course, b/c I use it. But if you get there first so be it :)

Both for of them they will not be in the core. The will have to be enabled by adding a library. And you will have to enable them with a command :repl/paren-edit-mode :parinfer or :repl/paren-edit-mode :paredit

I really want this available to users. But there is plenty to do first for before we get there.