dgrnbrg / vim-redl

A better Vim integration story for Clojure
106 stars 8 forks source link

Fireplace connects to repl in .nrepl-port - Redl doesn't #25

Closed clumsyjedi closed 10 years ago

clumsyjedi commented 10 years ago

Hi, this looks like a cool project.

I've been using fireplace for a while, and all my clojure projects have nrepl servers started in the background. When I issue fireplace commands such as :Eval I don't need to issue a :Connect beforehand, fireplace connects to the repl running on the port found in project_root/.nrepl-port.

Trying to issue a :Repl command from one of these projects brings up the message:

Error detected while processing function redl#repl#create..fireplace#evalparse..21_eval..firepla ce#client..fireplace#platform: line 32: E605: Exception not caught: Fireplace: :Connect to a REPL or install classpath.vim

If I explicitly issue a :Connect and give it a valid repl conn string then :Repl works from that point on.

Is it possible for me to automate this connection somehow? vim-fireplace, vim-redl, vim-clojure-static and vim-classpath are up to date.

dgrnbrg commented 10 years ago

I've only ever seen this issue when using redl w/ a repl that's not part of a leiningen project.

I'm not sure how the Vim python binding works, which is how fireplace is implemented. I'm not sure how to automate this though, sorry--@tpope probably knows, though!

tpope commented 10 years ago

Fireplace picks a REPL based on the full path of the current buffer. Since the :Repl buffer seems to be unnamed, I think when it does work, it's because it's accidentally picking up the current working directory instead.

I think a proper solution would be for fireplace to also consult a buffer local variable as a starting point. Perhaps b:java_root, since I'm already using that in a few other places.

mascip commented 10 years ago

Hi, I get exactly the same error, and I can connect with :Connect and then entering the port number indicated in the REPL. Let me know if I can do anything to investigate.

dgrnbrg commented 10 years ago

Once you've moved to the latest version, confirm with me that this works for you!

clumsyjedi commented 10 years ago

Yes it does!!! Thanks all.

mascip commented 10 years ago

With version 0.2.3 of redl and the latest commit of vim-redl I think (I couldn't find a version numbe), it doesn't work for me. On my laptop it's just the same as before: I must :Connect and give a port number, and then I can :Repl.

But sometimes (I don't manage to do it in a reproducible manner) it creates a bug that didn't exist in version 0.2.2: I do :Connect (and give the port number) followed by :Repl, then I can execute one command, and after that for any other command I get this error:

Error detected while processing function redl#repl#enter_hook..redl#repl#is_readable..fireplace#evalparse..<SNR>49_eval..fireplace#client..fireplace#platform:
line   32:
E605: Exception not caught: Fireplace: :Connect to a REPL or install classpath.vim
Error detected while processing function redl#repl#enter_hook:
line   29:
E171: Missing :endif

or sometimes I get that one, but when I re-try to run the same command in the same REPL, then I get the previous exception again :

Error detected while processing function redl#repl#enter_hook..redl#repl#eval..fireplace#evalparse..<SNR>49_eval..5..<SNR>49_conn_try:
line    5:
E605: Exception not caught: nREPL Connection Error: (4, 'Interrupted system call')
Error detected while processing function redl#repl#enter_hook:
line   32:
E171: Missing :endif

I checked in the redl#repl#enter_hook functions and didn't find an obvious missing endif; but I'm not very familiar with VimScript.

After that if I try to :Connect again it doesn't say anything, but when I run a command I still get the same error.

If I close the vim-redl buffer, and then :Connect and :Repl, then I can run one more command, and the same thing happens again.

PS: I re-did these tests with only one REPL open, and a lein profile which loads and injects spyscope and redl.

mascip commented 10 years ago

PS: when I revert to redl 0.2.2 I don't get these exceptions anymore, it's just like before.

dgrnbrg commented 10 years ago

Can you try 0.2.4?

On Sat, Aug 2, 2014 at 9:39 AM, Pierre Masci notifications@github.com wrote:

PS: when I revert to redl 0.2.2 I don't get these exceptions anymore, it's just like before.

— Reply to this email directly or view it on GitHub https://github.com/dgrnbrg/vim-redl/issues/25#issuecomment-50963030.

mascip commented 10 years ago

It works :) Lovely!