-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
ClojureScript: C-x C-e does not print results nor exceptions #830
Comments
I found the root cause. I have a fix for piggieback, but I am not 100% happy with the solution. It smells more like a workaround than a solution and can result in some performance problems. Final solution should be coordinated between cider, nrepl and piggieback. Some time ago cider stopped to use nrepl Piggieback's load file uses One could patch I think the core problem is that Solutions:
What do you think? (sorry for long post) |
This sounds like a bug to me.
See NREPL-59. Using
Doubt this is going to happen, so I think option 1 is the only realistic solution. |
Yeah, I get this, but it seems to me that having consistent behaviour in both Clojure and ClojureScript is important. I doubt that this would be significant problem in practice. |
@cemerick Any thoughts on this? |
One last thing I forgot to wrote. In ClojureScript, It seems that |
@danskarda In #861 using |
@bbatsov There is no I think I could change it piggieback, but I feel like navigating inside a labyrinth. You patch one thing and many other things backfire on you. Not good. But I will try. |
@bbatsov Support of Unfortunately this fix will not be available to 0.8 users until @cemerick makes new piggieback release and you change ps: I just saw your video from Clojure/conj on youtube. Great talk! thumbs up Will the unsession also be available? |
I'll do the CIDER change immediately after the new piggieback is out (and I'll cut a bugfix release).
They didn't record the unsessions. |
Just chiming in to say it's not clear to me what is actionable from a ClojureScript compiler point of view. If there is can someone please summarize? Thanks. |
@swannodette At this moment, there is nothing actionable from ClojureScript compiler POV.. Summary: CIDER uses load-file to evaluate expressions. It solves line/row number reporting (see NREPL-50) by producing file with ClojureScript REPL does not return last value and for good reason. It would have to print and parse a value of the last expression. This might be very expensive for complex data structures. So I made two changes to piggieback: load-file returns a value of last expression and interprets I deliberately have not implemented the changes in ClojureScript itself. It would not be OK to wrap last expressions in all files with Personally, I think using |
Forgive my ignorance, but why is this acceptable for Clojure and not for ClojureScript? That doesn't make any sense to me and as a tool writer I'd certainly prefer if
For the
I agree it sounds a bit odd and we'll probably modify the |
There's no good way to make ClojureScript return the last value from a ClojureScript file (if somebody has a brilliant idea I'm all ears). It's highly unlikely that we'll do anything about this. |
@bbatsov The difference between CLJ and CLJS: nREPL is CLJ, so when CLJS is different. If you need a value from That's why we had to implement it in piggieback. If we did it directly in CLJS, all There is one last difference between CLJ and CLJS. piggieback tries to parse the return CLJS value to CLJ value and if it is not able to do so (eg CLJS has a record which is not defined in CLJ), it returns the value as a output string. That's the reason why in CLJS simple values are printed in Emacs Minibuffer and "complex" to CIDER output buffer. |
I'm not comfortable with the proposed changes to piggieback, for a couple of reasons. First, Second, I don't want to further complicate piggieback to accommodate that abuse; the "in-sourcing" of Until someone does the work to add file/line/column options to both nREPL's and piggieback's Sorry for the perhaps disappointing response. I now regret suggesting the |
Perhaps. :-) Anyways, someone else would have to deal with this as I'm way too busy with other stuff. |
This is a little bit unfortunate. CIDER is after release declared most stable, but for CLJS it does not show results of evaluation not even exceptions and errors. You could imagine how satisfying is doing development in such environment. Could we agree on a plan and timeline for this bug? For example accept the patch as temporary workaround and than switch to perfect solution once it is ready? This bug is 2 months old. Given that we are all busy, I am worried that it will be not be solved in next few months. Possible solutions:
Do you have other suggestions? |
Stepping back a bit, I wonder: do the real use cases for "eval expr at point" require all of the constraints I described earlier (eval the form in question, applying file-accurate line numbers, and returning/printing the result)? Thinking of my own workflow, I have two use cases:
Are there really cases beyond these that demand both evaluation results and accurate source information? |
The problem with "temp" solutions is that they tend to stick around when nobody is feeling the urgency to fix them.
We can do something like this in Guess @cemerick's idea might be an acceptable workaround, though - we can use |
I've updated the code - now only |
@bbatsov Thank you! |
@bbatsov It's working great. Thanks! |
@danskarda One problem remains, though - because of the lack of Anyways, let's hope that eventually nREPL's |
Can't we just open a test branch on piggieback and test the recommendation off that? |
We know that |
…ve-eval` on `cider-request:load-file`
Cider stopped to print results of eval last expression from ClojureScript buffer.
Emacs just prints "nil" in the minibuffer. The result of evaluation is not printed in repl buffer. The only workaround is to use
(prn ...)
. Same applies to JS exceptions (they are lost). Clojure evaluation works fine.Setup: latest cider / cider-nrepl. Latest release of ClojureScript and piggieback. I tried different backends (austin with chrome, cljs-noderepl etc)
There are many dependencies which can go wrong. At this point I am not able to point my finger on exact cause. I try to investigate the issue over weekend.
The text was updated successfully, but these errors were encountered: