BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.67k stars 217 forks source link

Error connecting to the shadow.cljs REPL, introduced in v2.0.356 #2185

Closed dionysus98 closed 1 year ago

dionysus98 commented 1 year ago

In the default setting of "calva.autoEvaluateCode.onConnect.cljs" the cljs.repl requires a macro called "print-doc" which is undefined. (try (require '[cljs.repl :refer [apropos dir doc find-doc print-doc pst source]]) (catch :default e (js/console.warn "Failed to require cljs.repl utilities:" (.-message e))))

PEZ commented 1 year ago

Hi! Thanks for reporting. Which version of ClojureScript are you using? And how are you starting it? Does the connect fail?

dionysus98 commented 1 year ago

Hello! I'm using shadow-cljs v2.21.0 and clojurescript version v1.11.60

And I Jack-in using replConnectSequences

{
  "calva.replConnectSequences": [
    {
      "name": "km-admin",
      "projectType": "shadow-cljs",
      "cljsType": "shadow-cljs",
      "jackInEnv": {
        "DEBUG": true,
        "WA_SERVER": "undefined",
        "SVC_SERVER": "undefined",
      }
    }
  ]
}

And no, the connect doesn't seem to fail. But it doesn't seem to evaluate any external namespaces. For example, reagent.dom filepath cannot be found when I try to require it. Though building and the rest works fine as it is.

calva v2.0.355 doesn't seem to have any issues.

Thanks,

dionysus98 commented 1 year ago

Also the clj projects works fine, just cljs is having this issue.

PEZ commented 1 year ago

Thanks! I'll try to reproduce this with your connect sequence.

PEZ commented 1 year ago

Oh, one more thing. There's another change between 355 and 356 that might be what causes the problem with finding the filepath of external libraries. With 356 Calva should wait for you to start the ClojureScript app before the connect sequence connects the ClojureScript REPL. Does this seem to happen for you? Are you working on a browser app?

dionysus98 commented 1 year ago

Yes, I did read that in the docs and I'm working on a browser-app. I think it does happen that way, Calva prints the info "start your clojurescript app"

calva_jack_in

Hope this is helpful. And thank you for looking into it,

PEZ commented 1 year ago

Does Calva wait for you to start your app or does it continue without this being done?

PEZ commented 1 year ago

I see on the screenshot that the prompt is still a clj prompt when it should be a cljs one, so it it indicates that the ClojureScript REPL never is connected.

I can't reproduce this yet, @dionysus98, so will be spamming you with questions. 😄 One more thing you can test for me is to set calva.autoEvaluateCode.onConnect.cljs to null, and see if that makes the connection work. It could give us a clue to which new feature the error stems from.

dionysus98 commented 1 year ago

Sure, do spam me with questions. And as for clj session, if you look at line 21 it does try to start a cljs connection and stops there until it throws me an clojure.lang.compiler$CompilerException at line 28. And I've set it to null and an empty string before creating this issue but it's the same errors and even calva connection logs doesn't provide me much. I'll try again. Also a coworker of mine seem to be facing the same issue for cljs on a windows system.

PEZ commented 1 year ago

I can reproduce this in a project of mine now. Let's see if I also can fix it! 😄

dionysus98 commented 1 year ago

Okay great, thank you for doing this.

PEZ commented 1 year ago

Found the bug. I had hardcoded the build we were waiting for. Fixed it in dev. Will release it once I see that it passes CI tests.

dionysus98 commented 1 year ago

Thanks. That's great, I'll wait for the release.

PEZ commented 1 year ago

It's out now according to Microsoft. It can take a while before VS Code agrees, please have a check and take v2.0.358 for a spin. I'll be monitoring here for any reports on how you fare, @dionysus98.

dionysus98 commented 1 year ago

Okay, I'll check it out and let you know if there's still an issue.

dionysus98 commented 1 year ago

Checked just now. Repl connects fine for both clj and cljs. Thanks for the fix. c: @PEZ

PEZ commented 1 year ago

Thanks for reporting and being quick to reply here. Would have taken me ages to figure it out without your help!

dionysus98 commented 1 year ago

Really glad I was able to help.