Giter Club home page Giter Club logo

Comments (6)

d11wtq avatar d11wtq commented on June 23, 2024

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.

from boris.

steckerhalter avatar steckerhalter commented on June 23, 2024

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.

from boris.

steckerhalter avatar steckerhalter commented on June 23, 2024

here's another server/client thing for JS that does auto-completion and so on: http://ternjs.net/

from boris.

steckerhalter avatar steckerhalter commented on June 23, 2024

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...

from boris.

joddie avatar joddie commented on June 23, 2024

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.

from boris.

steckerhalter avatar steckerhalter commented on June 23, 2024

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?

from boris.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.