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

CLJ REPL window empty on new projects #225

Closed
felixlinker opened this issue Jun 13, 2019 · 11 comments
Closed

CLJ REPL window empty on new projects #225

felixlinker opened this issue Jun 13, 2019 · 11 comments

Comments

@felixlinker
Copy link

Whenever I start a new clojure project in vs-code, I can't connect to a REPL right away. My workflow is:

  1. Open a shell in vs-code an launch a repl via lein repl :headless
  2. Hit Ctrl+Alt+C, Ctrl+Alt+C and attempt to connect to the REPL using None as project type

The CLJ REPL tab opens and the status bar says: trying to connect but even after having waited for a while nothing happens.

I found the work-around to be: Use jack-in first (Ctrl+Alt+J). The problem with this, however, is that I'm on windows using the powershell and this command fails for me (cf. #195).

So, what I have to do in order to be able to connect to a REPL is:

  1. Hit Ctrl+Alt+J and let the command fail
  2. Close the shell that opened up
  3. Open a shell in vs-code an launch a repl via lein repl :headless
  4. Hit Ctrl+Alt+C, Ctrl+Alt+C and attempt to connect to the REPL using None as project type
@PEZ
Copy link
Collaborator

PEZ commented Jun 13, 2019

I think that the reason your first workflow fails it that the project lacks some dependency, making the connection fail. This should be detected better, and not just show an empty repl window, but anyway, that's what I think is going on.

The preferred way is of course jack-in instead. And I have some good news there: I've gotten some help in making it work for Powershell. Will release an update later today. If you want to try it before that I welcome you to join #calva-dev on Clojurians slack, where I will post a test version in a few moments.

Really strange that you get things to work using that last workaround, though... I don't quite understand why that would make a difference.

@felixlinker
Copy link
Author

When I first encountered this problem, I also thought it might have to do something with dependencies and tried to execute

lein.bat update-in :dependencies conj '[nrepl \"0.6.0\"]' -- update-in :plugins conj '[cider/cider-nrepl \"0.21.1\"]' -- update-in '[:repl-options :nrepl-middleware]' conj '[\"cider.nrepl/cider-middleware\"]' -- repl :headless

by hand. This, however, did not resolve the problem.

This would indicate to me that this is not a problem of dependencies as executing this command manually should have resolved this problem, right?

@PEZ
Copy link
Collaborator

PEZ commented Jun 13, 2019 via email

@felixlinker
Copy link
Author

It behaves as lein repl :headless. With the same issues when not pressed Ctrl+Alt+J and with the same effect when having pressed that combination.

@PEZ
Copy link
Collaborator

PEZ commented Jun 13, 2019

Yeah, I agree that that indicates this is not a dependency issue. I wonder what could be going on...

Can you give me some more context to your workflow? What OS are you on? How do you start VS Code? Which versions of everything are you using? Anything you can think of.

@felixlinker
Copy link
Author

OS: Windows 10 Version 10.0.17134 Build 17134
VS-Code Version: 1.35.1
Calva Version: [email protected] (as returned by code --list-extensions --show-versions)

General workflow when creating a new project:

  1. Open powershell and navigate to my git-dir
  2. lein new app prj-name
  3. code prj-name
  4. Try to start the REPL as described in the OP

It might also be worth noting that I encountered this problem after having had a project where the REPL just worked fine. That might be because with the recent calva update, I tried to use Ctrl+Alt+J immediately. I'm not sure on what follows, but depedencies seem to be installed globally installed with leiningen, right? I'm new to clojure so this might be wrong but as I have workspaces where Calva just works fine, I guess, all dependencies are installed.

@PEZ
Copy link
Collaborator

PEZ commented Jun 14, 2019

Yes, Leiningen installs dependencies globally on your machine. In the Maven repository. On a Mac or Linux machine this is found in your home directory in a directory named .m2, maybe something similar on Windows? You seldom have to worry about it, but it's good to know, I have had situations where it has helped deleting certain versions of stuff from that directory to get a clean install of them. (But, then again, I hack on libraries now and then so it is often that I have messed things up there. 😄 )

Thanks for the repro information. About wether your initial Jack-in attempt messed something up, I doubt it. Because the bug with powershell jack-in is such that Leiningen doesn't start doing its work. Speaking of which, have you tried if this workaround helps for your jack-in? As I said before, we are working on fixing Powershell Jack-in, but the workaround could be worth a try meanwhile.

That said, I suspect there is something with the project. Am I understanding correctly that connect works in other projects? Then again, it is lein new... I should try that myself and see what happens. In fact, I'll do that now.

@PEZ
Copy link
Collaborator

PEZ commented Jun 14, 2019

OK. So I can repro this perfectly on my Mac. It is indeed about the project lacking dependencies, but I should really make Calva detect this better. Thanks for reporting!

And jacking in to the project works fine. So this really gets down to fixing Jack-in for powershell. Please try that workaround I mentioned, while we are finishing that work.

@felixlinker
Copy link
Author

The workaround works for me. I also reassured myself that simply executing the command that is supposed to be executed does not resolve the problem.

Really a weird one if it has to do with dependencies.

@PEZ
Copy link
Collaborator

PEZ commented Jun 14, 2019 via email

@cfehse
Copy link
Contributor

cfehse commented Oct 13, 2019

@felixlinker

Can you try version 2.0.49. We made quite a lot of improvements to the connection process. I think the problems you experienced should be solved. I close this issue for now but feel free to reopen it.

Thanks!

@cfehse cfehse closed this as completed Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants