vimpire icon indicating copy to clipboard operation
vimpire copied to clipboard

Doesn't connect to repl with neovim

Open grinderrz opened this issue 6 years ago • 6 comments

macOS

$ cat src/user.clj
(ns user)

(def x "X")
$ clj '-J-Dclojure.server.repl={:port 5432 :accept clojure.core.server/repl}' -r  
Clojure 1.9.0  
user=> x  
"X"  
user=>  
$ nvim --version
NVIM v0.2.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/config -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/src/nvim/auto -I/tmp/neovim-20180209-92407-udkzoo/neovim-0.2.2/build/include
Compiled by [email protected]

Features: +acl +iconv +jemalloc +tui
...
$ nvim src/user.clj
:VimpireBite 127.0.0.1:5432

results in

Error detected while processing function vimpire#connection#RegisterPrefix[3]..vimpire#co
nnection#Start[1]..vimpire#connection#Connect:
line    2:
E475: Invalid argument: rpc option must be true

After fixing this with adding "rpc": v:true

     function! vimpire#connection#Connect(this, initCallback)
         return sockconnect("tcp", a:this.server,
-                    \ {"on_data":
+                    \ {"rpc": v:true,
+                    \  "on_data":
                     \  vimpire#connection#Dispatch(a:this, a:initCallback)})
     endfunction

There's no error anymore:

$ nvim src/user.clj
:VimpireBite 127.0.0.1:5432

:VimpireRepl

this opens 2 buffers with


Clojure

in first and

Could not determine the Namespace of the file.

This might have different reasons. Please check, that the server
is running and that the file does not contain syntax errors. The
interactive features will not be enabled.

Reason:
Vim(let):E716: Key not present in Dictionary: actions[a:action], a:bindings)

Call to sockconnect(...) now returns 2 (which is considered success), but call to "on_data" callback never happens for some reason. So we never finish initialization.

grinderrz avatar May 12 '18 10:05 grinderrz

This is only supported with neovim 0.3.0 currently. You can find nightly instructions for Mac https://github.com/neovim/neovim/wiki/Installing-Neovim#macos--os-x

SevereOverfl0w avatar May 12 '18 11:05 SevereOverfl0w

Thanks!

Now it seems to connect - I see a buffer with jgs ASCII art after :VimpireBite 127.0.0.1:5432. But it still doesn't work.

Trying to use <Plug>(vimpire_eval):


Vimpire could not initialise the server connection.
That means you will not be able to use the interactive features.
Reasons might be that the server is not running.

Vimpire will *not* start the server for you or handle the classpath.
There is a plethora of tools like ivy, maven, gradle and leiningen,
which do this better than Vimpire could ever do it.

Another reason might be, that you forgot to connect to the server
for your prefix with VimpireBite.

:VimpireRepl opens a buffer, but <Enter> is not working there - it blinks to normal mode and returns to insert mode immediately without any result printed.

$ ~/Downloads/nvim-osx64/bin/nvim --version
NVIM v0.3.0-1224-g273d2cd5d
Build type: Release
LuaJIT 2.0.5
Compilation: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/Users/travis/build/neovim/bot-ci/build/neovim/build/config -I/Users/travis/build/neovim/bot-ci/build/neovim/src -I/Users/travis/build/neovim/bot-ci/build/neovim/.deps/usr/include -I/usr/local/opt/gettext/include -I/usr/include -I/Users/travis/build/neovim/bot-ci/build/neovim/build/src/nvim/auto -I/Users/travis/build/neovim/bot-ci/build/neovim/build/include
Compiled by [email protected]

Features: +acl +iconv -jemalloc +tui

grinderrz avatar May 12 '18 11:05 grinderrz

You need neovim 0.2.3 for it to work. 0.2.2 does not support plain channels.

kotarak avatar May 12 '18 13:05 kotarak

What does :messages say?

kotarak avatar May 12 '18 13:05 kotarak

There's no neovim 0.2.3. Did you mean 0.3.0? As @SevereOverfl0w suggested, I now try with latest 0.3.0 dev release.

:messages says nothing interesting:

"src/user.clj" 3L, 23C

after :VimpireBite

and

"src/user.clj" 3L, 23C

after :VimpireRepl (empty line added)

grinderrz avatar May 12 '18 14:05 grinderrz

There's no neovim 0.2.3. Did you mean 0.3.0?

Ah. Maybe. I tried with some nightly build some time back. I though it was 0.2.3. But could as well have been 0.3.0. Don't remember.

:messages says nothing interesting:

Unfortunately, VimpireBite is rather optimistic. Too optimistic at times. Even more unfortunately, neovim does not provide easy means to hook into the conversation with the server. Vim has ch_logfile, which is rather useful. Hence, you'll have to find a different way to intercept the interaction somehow to diagnose what's going on.

I'm working on robustness improvements and better error handling and reporting. But that isn't a thing, yet.

kotarak avatar May 12 '18 18:05 kotarak