-
Notifications
You must be signed in to change notification settings - Fork 115
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
Make the REPL accessible via network #47
Comments
Agreed. This is planned. First I need to define a protocol for the communication, then rewrite the readline client to use it. One of the other reasons for defining a protocol is because some things like auto-completion could then be added as protocol extensions. There is some complexity with long-running (and/or concurrent) operations that are producing output which needs to be sent over the network. Currently, because the output is simply sent to stdout, there's no need to handle that sort of thing. |
Cool. I really missed a REPL with PHP. SWANK is an RPC protocol. It would allow easy integration with Emacs for example. But maybe there is another protocol you might want to consider. |
here's another server/client thing for JS that does auto-completion and so on: http://ternjs.net/ |
just so that you might be aware of it. there is already an Emacs mode to make the REPL work under Emacs: https://github.com/tomterl/php-boris I wrote a minor mode that uses that to allow sending parts of a PHP buffer to the REPL in Emacs: https://github.com/steckerhalter/php-boris-minor-mode It's already close to what you can do with Clojure and nrepl (https://github.com/clojure-emacs/nrepl.el). So for the networking part... have you thought about the protocol to use? Btw, there's also https://github.com/tailrecursion/wigwam, but it uses some readline functions that don't work on Debian/Ubuntu PHP. Maybe that can give some inspiration too... |
I did a quick hack to play with this idea and pushed it to https://github.com/joddie/boris/tree/completion-and-network-hacks. It's pretty rough still, but it works well enough for me to get context-aware completion while running Boris under Emacs when the included boris-completion.el is loaded. Completion also sort of works in a terminal, with minor annoyances, if PHP is compiled with GNU readline. It should be smart enough to complete the appropriate normal & static object members and array indexes at any level of nesting, as well as the usual constants/functions/classes/namespaces. The socket protocol uses JSON messages preceded by 4 bytes giving the length of the data. It would definitely need some extra work to be reliable. I should emphasise that this was just a hack to experiment with the idea, which may not match @d11wtq's future plans for boris. However, if there is interest in using part or all of it, I'm happy to try refactoring things. |
I have been hacking on a SLIME backend for PHP (https://github.com/steckerhalter/swank-php) and was using what @joddie already added to communicate with the REPL. Only completion and documentation is available with his extensions so I'll be trying to add evaluation too. Can someone else look at the code from Joddie too and see if this might be ok to proceed or not? |
For example a SWANK backend could be written (http://common-lisp.net/project/slime/).
For reference: a JS SWANK implementation: https://github.com/swank-js/swank-js
Any thoughts?
The text was updated successfully, but these errors were encountered: