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

Add Figwheel-Main Support #171

Open
athomasoriginal opened this issue Apr 16, 2020 · 9 comments
Open

Add Figwheel-Main Support #171

athomasoriginal opened this issue Apr 16, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@athomasoriginal
Copy link

athomasoriginal commented Apr 16, 2020

What's Up?

It would be sweet to be able to connect to the figwheel-main repl through atom.

M'kay, tell me more

Based on the quick conversation we had over slack, I wanted to start an issue and to document some of the tips you provided RE: how to tackle this problem. This will also be good to track any progress on this topic.

How to start?

@mauricioszabo mauricioszabo added the enhancement New feature or request label Apr 17, 2020
@rafd
Copy link
Contributor

rafd commented Aug 14, 2020

Something that may make connecting chlorine and figwheel-main easier is that it is possible to expose a socket REPL on top of a figwheel-main REPL, as per the example here: https://oli.me.uk/clojure-socket-prepl-cookbook/#_figwheel_and_prepl

I can telnet and issue commands to the socket-REPL-over-figwheel-REPL, but, if I try to have chlorine connect to it, chlorine silently fails.

@seancorfield
Copy link
Contributor

@rafd That's because the example starts a prepl, not a regular socket REPL. I think that if you change io-prepl to io-repl or perhaps just repl then it will work?

A plain Socket REPL has a prompt and returns text. A prepl is a programmatic REPL and has no prompt and it returns a hash map with the form read, the value returned, and also any output and errors,

@mauricioszabo It would be nice if Chlorine could connect to a prepl as well as a plain Socket REPL (and probably easier, since prepl is designed for programs to talk to Clojure?).

@rafd
Copy link
Contributor

rafd commented Aug 14, 2020

@seancorfield Thanks for the clarification.

No io-repl exists in cljs.*, but I was able to get it working (!!!) with the following:

(defn io-repl
  [& {:keys [repl-env]}]
  (cljs.repl/repl repl-env))

And the :accept changed to point to wherever the above function is defined.

@mauricioszabo
Copy link
Owner

@seancorfield maybe. I believe it can work, will try to implement and see what happens :). The only problem is that prepl on Clojure does not support reader literals, that's something I really need for Chlorine to detect which REPL is currently running...

@rafd this can probably work for a simple tooling support. If you want autocomplete with compliment / suitable for ClojureScript, this approach with prepl will not work, but at least figwheel will be an official supported implementation :)

@athomasoriginal
Copy link
Author

athomasoriginal commented Dec 24, 2020

Quick update. While this is still on my radar, I have a demo repo setup which will illustrates @rafd suggestion above. Thus, @mauricioszabo is correct and we can say it's "officially" supported hehe.

One thing I noticed is that depending on the CLJS version used, this approach can fail. The failing version of CLJS was 1.10.821

I haven't done much real world experiments with it other than to see that it works, but this is a good start and nice stop gap while a more complete solution is explored. Hope this helps people!

@mauricioszabo
Copy link
Owner

Wow, @athomasoriginal, great job! I'll try to wrap around everything you did on your project, but looks promising!

You did say that this approach can fail because of CLJS version used. Why is that? Do you have any insight on how to solve this issue?

@athomasoriginal
Copy link
Author

athomasoriginal commented Dec 29, 2020

Thanks, @mauricioszabo, but, just to clarify, the little demo is really just what rafd suggested...I just put it in a project, documented and experimented a bit so others could look to it if needed 🤣

You did say that this approach can fail because of CLJS version used.

Yeah, I noticed that this can happen. I actually spent a few hours digging into this a while back and and wrote about it. I'm not sure if they are linked, but symptoms are similar. When we open the URL suggested by the CLJS REPL session, and we get a connection, the connection spews a stack trace and timesout.

@seancorfield
Copy link
Contributor

What's the status of this, in the context of Pulsar?

@mauricioszabo
Copy link
Owner

Not yet done. I am currently full-time on Pulsar, but things are getting more stable. In the meantime, I am making some decisions about Chlorine - one of them is that I'll probably remove support for socket-repl, which makes this solution outdated. But I'll update here as soon as I end up with a decision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants