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

Unable to start nREPL #47

Closed
cdcme opened this issue Jul 20, 2017 · 7 comments · Fixed by #50
Closed

Unable to start nREPL #47

cdcme opened this issue Jul 20, 2017 · 7 comments · Fixed by #50
Labels

Comments

@cdcme
Copy link

cdcme commented Jul 20, 2017

Description: When opening a lein project for the first time or choosing Clojure: start nREPL from the command palette, the nREPL is not started and the error, "Can't start nREPL." is seen. Nothing is shown in the Problems or Debug Console panel.

System info

  • macOS Sierra 10.12.6
  • VSCode 1.14.1
  • clojureVSCode 0.7.4
  • Leiningen 2.7.1
  • Clojure 1.8.0
  • REPL-y 0.3,7, nREPL 0.2.12
  • Java 1.8.0_131-b11

Steps to reproduce

  1. Start a new Clojure project with lein new app foo && cd foo
  2. Open the project in VSCode and open src/foo/core.clj
  3. Note that the error "Can't start nREPL." is shown
  4. Open command palette with Cmd+Shift+P
  5. Select Clojure: start nREPL
  6. Note that the error "Can't start nREPL." is shown

Starting a REPL in the CLI and connecting as described in #11 works perfectly, though.

@avli avli added the bug label Jul 21, 2017
@avli
Copy link
Owner

avli commented Jul 21, 2017

Yes, I can confirm there is a bug but I cannot reproduce it in 100% cases – sometimes nREPL starts fine, sometimes it fails to start. I don't see the pattern yet, more debugging is needed. I'll do my best to fix it as soon as possible.

@pdkovacs
Copy link

pdkovacs commented Jul 23, 2017

I am having the same issue...

Starting a REPL in the CLI and connecting as described in #11 works perfectly, though.

I am starting repl via boot in a "stand-alone" terminal and the VS Code plugin appears to successfully connect to it (via the "Connect to a running nREPL" command), but nothing clojure-specific works in the IDE (no code-completion, no docs).

I cannot reproduce it in 100% cases

I can reproduce it 10 out of 10 attempts.

@pdkovacs
Copy link

It seems that the plugin stops the repl in nreplController.ts#49, if it (the repl) writes anything onto the standard error. I tried to construct the command executed by the plugin to start the repl:

lein update-in ':dependencies' conj '[org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]' -- update-in ':plugins' conj '[refactor-nrepl "2.3.0-SNAPSHOT"]' -- update-in ':plugins' conj '[cider/cider-nrepl "0.15.0-SNAPSHOT"]' -- repl

The above command does indeed produces output on the standard error:

Warning: refactor-nrepl needs to run in the context of a project.
Warning: refactor-nrepl middleware won't be activated.
Warning: refactor-nrepl needs to run in the context of a project.
Warning: refactor-nrepl middleware won't be activated.
Warning: refactor-nrepl needs to run in the context of a project.
Warning: refactor-nrepl middleware won't be activated.
Warning: refactor-nrepl needs to run in the context of a project.
Warning: refactor-nrepl middleware won't be activated.

, even though the repl seems to come up without error.

I locally changed the plugin to ignore the standard error of the repl. With this change, I don't get the Can't start nREPL error message anymore, but the plugin doesn't really work (as when connecting to an already running repl — see my comment above).

@pdkovacs
Copy link

pdkovacs commented Jul 23, 2017

Hmm, after following the boot-related config steps described in https://github.com/boot-clj/boot/wiki/Cider-REPL (more specifically fixing ~/.boot/profile.boot described in A better way / point 1.), everything works nicely for me.

@fasfsfgs
Copy link
Contributor

Start nREPL has a bug. And it's probably related to #48.

But what you further said @pdkovacs is something more I think. At first we just support lein and didn't think about boot yet.

When you Connect to a running nREPL, it needs to have some dependencies. So this other bug you found is probably related to #31. We had a couple steps to manually add dependencies on earlier versions. That's probably what you had to do with boot profile. Does this make sense @pdkovacs?

If you don't mind, can you please explicitly show us what steps you followed to config boot? That would help us provide this kind of info for our users.

fasfsfgs pushed a commit to fasfsfgs/clojureVSCode that referenced this issue Jul 23, 2017
This closes avli#47 and closes avli#48.
@pdkovacs
Copy link

pdkovacs commented Jul 23, 2017

After working some more with VS Code, it turned out that code completion doesn't work for me with a Boot REPL after all. With the plugin's built-in REPL starter, code-completion seems to work, but as I currently have my project configurations in Boot, I cannot really use it for testing.

In addition to the user-global profile, I mentioned in my previous comment, I have my project specific Boot settings as in https://github.com/pdkovacs/clj-todo .

Thinking about what might have solved the actual issue at hand for me, I have removed something (sorry, I don't remember anymore exactly what it was) from ~/lein/profiles.clj. It is currently at the bare minimum of:

{:user
  {:dependencies [[org.clojure/tools.nrepl "0.2.13"]]}
}

Let me know if I can help any more with this.

@fasfsfgs
Copy link
Contributor

I opened #51 for boot support for Connect to a running nREPL @pdkovacs.
We'll discuss this there.

@avli avli closed this as completed in #50 Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants