clojure-vim / acid.nvim

Asynchronous Clojure Interactive Development
161 stars 12 forks source link

The "K" keybinding to look up docs throws an error #35

Closed daveyarwood closed 5 years ago

daveyarwood commented 5 years ago

After the port to lua, I was able to install acid, run a REPL in another terminal, and then use it from Neovim by running :AcidRequire and then eval-ing forms with cpp.

However, when I put my cursor over a symbol and press K to look up the docs, I get this error:

error caught while executing async callback:
NvimError(b"Vim:E5108: Error while calling lua chunk for luaeval(): ...me/dave/.vim/bundle/acid.nvim//lua/acid/features.lua:120: attempt to concatenate field 'name' (a nil value)",)
Traceback (most recent call last):
  File "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid/__init__.py", line 38, in <lambda>
    nvim.async_call(lambda: handler_impl(msg, wc, key))
  File "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid/__init__.py", line 21, in impl
    nvim.funcs.luaeval(lua_cmd, msg)
  File "/usr/local/lib/python3.5/dist-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.nvim.NvimError: b"Vim:E5108: Error while calling lua chunk for luaeval(): ...me/dave/.vim/bundle/acid.nvim//lua/acid/features.lua:120: attempt to concatenate field 'name' (a nil value)"

the call was requested at
  File "/usr/lib/python3.5/threading.py", line 882, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "../../.vim/bundle/acid.nvim/rplugin/python3/acid/nrepl/__init__.py", line 68, in run
    callback(incoming, self, key)
  File "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid/__init__.py", line 38, in handler
    nvim.async_call(lambda: handler_impl(msg, wc, key))
hkupty commented 5 years ago

Hi @daveyarwood, Thanks for the issue.

I tried to reproduce it here but I couldn't. Can you give me more context? Also, there's a log file: /tmp/acid-log-handler.log

You can find what acid sent and what it got back, that can be helpful so I can understand when the nrepl can send the message without name.

Cheers, Henry

daveyarwood commented 5 years ago

After updating acid, I'm getting a different error now from the one I posted above.

When I put my cursor over a reference to a function (stream-seq) that I defined earlier in the same file and press K, I get this error:

error caught while executing async callback:
NvimError(b'Vim:E5108: Error while calling lua chunk for luaeval(): ...im/bundle/acid.nvim//lua/acid/middlewares/floats.lua:58: Expected 3 arguments',)
Traceback (most recent call last):
  File "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid/__init__.py", line 38, in <lambda>
    nvim.async_call(lambda: handler_impl(msg, wc, key))
  File "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid/__init__.py", line 21, in impl
    nvim.funcs.luaeval(lua_cmd, msg)
  File "/usr/local/lib/python3.5/dist-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.nvim.NvimError: b'Vim:E5108: Error while calling lua chunk for luaeval(): ...im/bundle/acid.nvim//lua/acid/middlewares/floats.lua:58: Expected 3 arguments'

the call was requested at
  File "/usr/lib/python3.5/threading.py", line 882, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "../../.vim/bundle/acid.nvim/rplugin/python3/acid/nrepl/__init__.py", line 68, in run
    callback(incoming, self, key)
  File "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid/__init__.py", line 38, in handler
    nvim.async_call(lambda: handler_impl(msg, wc, key))

From /tmp/acid-log-handler.log:

2019-03-23 17:54:07,341 - [acid.nvim :DEBUG] - fpath is None
2019-03-23 17:54:07,343 - [acid.nvim :DEBUG] - Hitting cache for ns 'alda.parser'
2019-03-23 17:54:07,346 - [acid.session :INFO] - sending data -> {'symbol': 'stream-seq', 'id': '37f59c00b7e04079972e3522f856fc83', 'op': 'eldoc', 'ns': 'alda.parser'}
2019-03-23 17:54:07,398 - [acid.session :INFO] - stopped watching key 37f59c00b7e04079972e3522f856fc83-31b0f83a9275498cb23f827f50c89e04-watcher
2019-03-23 17:54:07,400 - [acid :INFO] - {'name': 'stream-seq', 'session': 'c7714bac-4b3f-499a-a294-7d2a3540b71e', 'id': '37f59c00b7e04079972e3522f856fc83', 'docstring': 'Coerces a channel into a lazy sequence that can be lazily consumed or\n   realized at will.', 'eldoc': [['ch']], 'status': ['done'], 'type': 'function', 'ns': 'alda.parser'}
hkupty commented 5 years ago

Is this one still happening?

daveyarwood commented 5 years ago

I'm unable to test, as after updating, I'm still experiencing a variant of #56, so I can't successfully invoke :AcidRequire.

daveyarwood commented 5 years ago

Running acid.nvim on the fix/get-ns-issue branch to circumvent #56, I still get the same error I posted above when I use K.

hkupty commented 5 years ago

Asking for docs on java methods return the data differently from the response to a clojure symbols docs request, so the fn should be more flexible now.

Please check and let me know if I can close this issue.

Best

daveyarwood commented 5 years ago

Hmm, after updating, I get this error when I run :AcidRequire:

Error detected while processing :
E5105: Error while calling lua chunk: ...me/dave/.vim/bundle/acid.nvim//lua/acid/features.lua:91: Vim(let):no request handler registered for "/home/dave/.vim/bundle/acid.nvim/rplugin/python3/acid:function:AcidGetNs"
hkupty commented 5 years ago

:weary:

hkupty commented 5 years ago

From that fix to HEAD, this is the only commit that changes rplugin: 3f195e57e7a158

I'll investigate further, but apparently #56 is back.

hkupty commented 5 years ago

Looks like #57 worked because of this actually: ebfb32ab49b69794239f2a2dc7b.

I know how to fix that then.

daveyarwood commented 5 years ago

K is working nicely after updating just now :+1: :100:

daveyarwood commented 5 years ago

It's working both for Clojure functions and Java interop forms.

Nicely done!

hkupty commented 5 years ago

Awesome!