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

Can't start standalone REPLs with LiveShare extensions enabled #1569

Closed
adomurad opened this issue Mar 2, 2022 · 16 comments
Closed

Can't start standalone REPLs with LiveShare extensions enabled #1569

adomurad opened this issue Mar 2, 2022 · 16 comments
Labels

Comments

@adomurad
Copy link

adomurad commented Mar 2, 2022

Hello,

I've just started with Clojure and wanted to checkout the Calva extension for vscode.

In the output of "Calva says" I can see a message:

Welcome to Calva. Happy Clojure and ClojureScript coding! ❤️

Please check these resources out:
Calva Documentation: https://calva.io/
#calva at the Clojurians Slack: https://clojurians.slack.com/messages/calva/
Bug reports: https://github.com/BetterThanTomorrow/calva/issues

If you like Calva, please consider how you can contribute: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Contribute

Calva is utilizing cider-nrepl and clojure-lsp to create this VS Code experience.
nREPL dependencies configured:
nrepl: 0.9.0
cider-nrepl: 0.27.4
cider/piggieback: 0.5.3
clojure-lsp version configured: latest

If you are new to Calva, please consider starting with the command:
Calva: Fire up the Getting Started REPL
https://calva.io/getting-started/

(See showCalvaSaysOnStart in Settings to control the auto-showing of this message panel.)

clojure-lsp version used: 2022.02.23-12.12.12
clj-kondo version used: 2022.02.09

But it seems not to work at all...
When I use the command: "Start a standalone REPL (not in project)" then a new file in a temp dir appears "user.clj" with the content (ns user)"
But no REPL window appears, and on the status bar I see: "REPL Disconnected".

I have the same issue with the command: "Calva: Fire up the Getting Started REPL"

I'm using MacOS Monterey and my java version is:

openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

I did check all the output windows from vscode and didn't find any error with clojure nor the extension...

Can you help me with this issue? I would really like to start learning Clojure - and check what with the fuzz around the REPL in this community ;)

@PEZ
Copy link
Collaborator

PEZ commented Mar 2, 2022

Hi there! So happy you want to try Clojure and that you choose to do it with Calva. And so sorry Calva is giving you troubles!

While we try to figure out what is going wrong, you can try it in the browser, avoiding any issues on your machine: https://calva.io/get-started-with-clojure/

@PEZ
Copy link
Collaborator

PEZ commented Mar 2, 2022

When you issue the commands on your machine, do you see a Calva Jack in tab in the Terminal pane open?
image

@adomurad
Copy link
Author

adomurad commented Mar 2, 2022

No, I don't.

@adomurad
Copy link
Author

adomurad commented Mar 2, 2022

When I use any of those commands, nothing really happens (besides opening new files in the temp directory)

Screenshot 2022-03-02 at 14 29 16

@adomurad
Copy link
Author

adomurad commented Mar 2, 2022

I did some reading and tried to launch my own repl with a socket, like this:
JVM_OPTS='-Dclojure.server.myrepl={:port,50505,:accept,clojure.core.server/repl}' lein repl

nREPL server started on port 53811 on host 127.0.0.1 - nrepl://127.0.0.1:53811
REPL-y 0.5.1, nREPL 0.8.3
Clojure 1.10.3
OpenJDK 64-Bit Server VM 11.0.2+9
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e

And in vscode I have launched the command: Connect to a running REPL, not in your project and selected the Leiningen option, typed in the correct port 53811, and it works!

So the problem seems to be starting the repl by Calva...

@PEZ
Copy link
Collaborator

PEZ commented Mar 2, 2022

If you have the developer tools open when you use any of those commands, do you see anything suspicious being logged?

@adomurad
Copy link
Author

adomurad commented Mar 2, 2022

I have checked the dev tools and there is an error in the console when trying to launch the Start a standalone REPL (not in project) command.

Screenshot 2022-03-02 at 16 16 45

There is nothing happening in the logs when trying to run Start your project with a REPL and connect (a.k.a. Jack-in) - but not sure if I'm using this one correctly.

@PEZ PEZ changed the title Can't start REPL Can't start standalone REPLs Mar 2, 2022
@PEZ
Copy link
Collaborator

PEZ commented Mar 2, 2022

It would be super useful to see what [[Object Object]] contains. 😄

Jokes aside, tricky trace to make something out of, especially since I can't find a reference to Calva code there. This is the first time I hear about this problem, and I can't reproduce it. If you have the time, it would be great if you can run Calva in development mode and try catch this thing in the debugger. It is actually pretty easy to get it running in development mode. Please see: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Hack-on-Calva

@adomurad
Copy link
Author

adomurad commented Mar 2, 2022

OK, I will try to debug the issue in the next couple of days, and will post the results and any findings here 🙂

@adomurad
Copy link
Author

adomurad commented Mar 2, 2022

I did some debugging on the Calva vscode extension and I found the problem.
Basically one Promise in function setupLiveShareListener() was hanging (neither resolving nor rejecting):

liveShare = await vsls.getApi();

And after disabling both MS Live Share extensions, it started working :)

Screenshot 2022-03-02 at 20 12 15

Thanks for all your help 🙂
I already have a good time playing with Clojure using Calva <3

@PEZ PEZ changed the title Can't start standalone REPLs Can't start standalone REPLs with LiveShare extensions enabled Mar 2, 2022
@PEZ
Copy link
Collaborator

PEZ commented Mar 2, 2022

That was quick!

Thanks for reporting this and helping to find the culprit. This could be a regression in Calva, or something that has changed in the LiveShare extensions. Very good that we know about it and can try fix it. At the very least we could timeout waiting for that promise to resolve or reject.

@PEZ PEZ added bug Something isn't working live share repl labels Mar 2, 2022
@TuggyNE
Copy link

TuggyNE commented Mar 14, 2022

Must be a recent regression; I've had Live Share extensions enabled alongside Calva for months, but one of the Calva updates in the last few weeks probably broke compatibility, since I updated Calva today and found I couldn't start any REPLs in projects. (No errors logged, but the REPL started once I disabled Live Share.)

Live Share hasn't updated recently, AFAICT, although of course VS Code has.

@PEZ
Copy link
Collaborator

PEZ commented Mar 14, 2022

@TuggyNE if you can bisect it and find where the regression happened, that would be very helpful! There's a cog wheel on the Calva item in the Extensions view that will let you use any previous version. At least it should be quick to check if the version you used last time it worked, still works. The changelog might help you figure out which version that could have been.

@stefan-toubia
Copy link
Contributor

I also encountered the same issue yesterday, I couldn't start a REPL due to the live share API hanging indefinitely.
It only just started happening for me yesterday, and I am usually on the latest version of Calva. I didn't spend too much time debugging, though I did try rolling back to 2.0.253 but still had the issue. But I've also been on at least that version or a more recent version pretty much all week. Disabling Live Share fixed the issue for me.

Aside from the obvious issue of the Live Share bug, what do you think about moving the Live Share setup lower in the REPL connection sequence? The most annoying part of this issue is that the editor just doesn't respond to your input. No connection sequence menu, no output in Calva Says, nothing. Maybe as a temporary fix also consider adding a timeout? I'm not sure what is happening under the hood with that Live Share API, is it making network requests?

@PEZ
Copy link
Collaborator

PEZ commented Mar 26, 2022

Bad news: It seems to be a problem in LiveShare that is quite intermittent to its nature.

microsoft/live-share#4551

Good news: I finally am able to reproduce it. At least sometimes.

@PEZ PEZ added the upstream label Mar 26, 2022
@PEZ
Copy link
Collaborator

PEZ commented Mar 26, 2022

That upstream issue could also be what happens in #1625

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

No branches or pull requests

4 participants