editors

Discussion about all editors used for Clojure/ClojureScript
dominicm 2016-08-25T13:20:06.000060Z

@juhoteperi: That bug you found in clj-async-omni seems to be an underlying bug in the nrepl-python-client

juhoteperi 2016-08-25T13:21:33.000061Z

Hmm? Or just how nrepl-python-client works

juhoteperi 2016-08-25T13:21:58.000062Z

Are you refering to the bug I fixed or some other bug?

dominicm 2016-08-25T13:23:04.000063Z

With the original bdecode:

❯ python notadrill.py
>>  {'symbol': 'a.s.', 'ns': 'myns', 'op': 'complete'}
<< {}
<< session
<< c36ce69a-0a16-4323-af89-6d972dd6902c
<< status
<< ['done']
<< None
Swapping in the bdecode that fireplace uses:
>>  {'op': 'complete', 'symbol': 'a.s.', 'ns': 'teamhero.microformat'}
<< {'completions': [], 'status': ['done'], 'session': '92e73f6a-52b2-4c22-a9da-a3b274114a3d'}
--- The bug you fixed. I think it's good to do a truthy check there, but I think we were hitting it due to getting "None" back due to the bad bdecode

juhoteperi 2016-08-25T13:26:54.000064Z

So looks like nrepl.bencode is calling connection read after it has already finished reading the message or something?

dominicm 2016-08-25T13:29:47.000065Z

nrepl.bdecode seems to get confused and end the map prematurely (resulting in the {} on line 3)

dominicm 2016-08-25T13:30:14.000066Z

That leaves additional data on the buffer, so it reads again.

dominicm 2016-08-25T13:31:07.000067Z

Ah! and then we get None, because the real end of the map is left in the buffer, and nrepl.bdecode returns None if it doesn't understand

juhoteperi 2016-08-25T13:32:26.000068Z

hmm, fireplace has working implementation written in python?

juhoteperi 2016-08-25T13:34:06.000069Z

perhaps we could just copy nrepl_fireplace.py into clj-async-omni and modify it for our purposes

juhoteperi 2016-08-25T13:34:16.000070Z

would also remove need for submodule

dominicm 2016-08-25T13:36:02.000072Z

Yeah, that's my thoughts as well. Licensing and copyright slightly concerns me though, so I might have to dig in to that a little.

juhoteperi 2016-08-25T13:37:05.000074Z

Would be easiest if you select to use Vim license for async-clj-omni, and then just add a comment to the file

juhoteperi 2016-08-25T13:37:35.000075Z

But even if you select another license for the project, you can keep the copied file under Vim license

dominicm 2016-08-25T13:38:08.000076Z

ah, misread your suggestion of using all of nrepl_fireplace.py.

dominicm 2016-08-25T13:38:57.000077Z

There's a problem with that, nrepl_python_client provides a watchable connection, which is pretty key to being able to cache connections. So it would need implementing on top of nrepl_fireplace.

juhoteperi 2016-08-25T13:39:30.000078Z

Hmm, true, fireplace implements that it Vimscript side

dominicm 2016-08-25T13:40:07.000079Z

Does fireplace even use watchable connections? I thought the blocking nature of it, meant it could just keep reading for the duration of the evaluation.

juhoteperi 2016-08-25T13:40:35.000080Z

Some part of fireplace code is async, only the Vim side blocks

dominicm 2016-08-25T13:41:21.000081Z

Interesting.

dominicm 2016-08-25T13:41:53.000082Z

Maybe I can figure out the bdecode bug, and fix it, using nrepl_fireplace as an example to draw inspiration from

dominicm 2016-08-25T14:00:59.000083Z

Gotcha, it's a truthy check failure.

dominicm 2016-08-25T14:31:01.000084Z

PR is opened.