Fork me on GitHub
#conjure
<
2020-04-27
>
Olical13:04:42

Just finished the documentation for now. I think? So there's core docs (`:h conjure`), Fennel Aniseed (`:h conjure-client-fennel-aniseed`) and Clojure nREPL (`:h conjure-client-clojure-nrepl`).

rafaeldelboni15:04:55

Hey thanks for all your work! I found something in the docs:

<localleader>rr          Refresh all changed namespaces.
<localleader>rr          Refresh all namespaces, even unchanged.
Is the same command?

Olical15:04:20

Ah, good spot!

Olical13:04:48

Going to have a go at making this stdout handle chunked nREPL messages now, but I think it might be close to release 😬 If anyone thinks docs / UI / UX could be improved for an initial version, please do let me know. I just want to make this the defacto version on the master branch soon so I can continue to improve it knowing there's no more new people using the old version.

Olical13:04:51

The interactive school to teach you the mappings and UX will be post release, but I still want to do it

rafaeldelboni15:04:08

How can I make some log to report a issue on the new conjure? I have a case while evaluating a big project here that makes my nvim hangs a few seconds after I send the evaluation command, I suspect is because the result is a really big message with the entire system map in memory returned (this worked fine in the old conjure)

Olical15:04:47

I think GitHub issues is still the way to go, that's the best way for myself and others to keep track of it. If you're getting a HUGE result back it could definitely be the parsing and displaying of it, yeah.

Olical15:04:59

It's a valid issue that I should find a way around.

rafaeldelboni15:04:21

or maybe a way to not parse a result or ignore the result?

Olical15:04:57

Hmm, I don't think it should be on you to know that the result will be too big.

Olical15:04:03

I'd perfer to find a way to fix it for you. Maybe try :ConjureConfig clojure.nrepl/eval.pretty-print? false and see if that makes a difference too :thinking_face:

rafaeldelboni15:04:43

ok I will think a way to reproduce this in a isolated project

Olical15:04:10

What did you evaluate out of interest?

rafaeldelboni15:04:55

is a file, but is a pathom project that reloads all the maps of resolvers and mutations and returns as result of the eval (don't know why they decided to this in this way)

Olical15:04:06

Ah okay. Would be interesting to see if evaluating (do (slow-thing) nil) and also evaluating as normal but with pretty printing off would make a difference.

rafaeldelboni15:04:25

I will try both

Olical15:04:42

I haven't evaluated anything that returns a big enough result yet, but I suspect something with a LOT of lines involves time pretty printing, parsing and then formatting and inserting into the log buffer.

Olical15:04:08

It'll even incur more data to be parsed because of all the whitespace!

rafaeldelboni15:04:04

yeap pretty print false did the trick

rafaeldelboni15:04:17

can we disable it when the output is to big

rafaeldelboni15:04:31

but this lead to another question what is to big?

Olical15:04:31

Interesting! But Neovim locked up entirely while you were waiting?

rafaeldelboni15:04:41

like full lock

rafaeldelboni15:04:47

had to kill my process

Olical15:04:55

I'm not in control of the pprint flag after eval, I turn it on before eval.

Olical15:04:14

It's done by nREPL itself

rafaeldelboni15:04:25

without the pretty print is super fast

Olical15:04:50

I think the problem is the efficiency of inserting so many lines to be honest. I'll have a look at what could be slow at inserting lots into the buffer.

rafaeldelboni15:04:37

I will go with eval.pretty-print = false, since is similar of what I had on the older conjure

Olical15:04:39

I'll get some way to reproduce it myself and try to fix it rather than just turn off pprint. It shouldn't really be a problem.

rafaeldelboni15:04:05

maybe parse a huge internet json

Olical15:04:36

Yup, something like that good idea!

Olical16:04:16

Hmm, evaluated range 10000 and it was fine, didn't lock up neovim at all, so I wonder if it's the syntax highlighting etc.

Olical16:04:35

So maybe if I fold large results it'll fix it :thinking_face:

rafaeldelboni16:04:31

can I somehow store the eval result to check how many lines?

Olical16:04:51

Hmm, you could capture it with (def x (my-code)) then (count (clojure.string/split-lines (with-out-str (clojure.pprint/pprint x))))

Olical16:04:47

One other thing you could try since I can't seem to reproduce and I have a hunch: Open up the log buffer, run :set ft=text and then try to reproduce the issue.

Olical16:04:02

If it's suddenly fast, it proves it's Vim locking up trying to syntax highlight.

rafaeldelboni16:04:30

with the pretty-print true

rafaeldelboni16:04:58

still hangs, but maybe I have to disable the hud

Olical16:04:13

Nope that's okay, I'd expect it to be pprinted, but not highlighted?

rafaeldelboni16:04:13

because it stills shows up pprinted

Olical16:04:39

It should just be black and white (depending on your terminal)

Olical16:04:33

Wow, well I'd love to know how big that result is when pretty printed then 😄

rafaeldelboni16:04:12

with sintax highlight I locked vim forever

rafaeldelboni16:04:18

now It just hangs

rafaeldelboni16:04:34

like 20 secs hahaha

Olical16:04:02

Interesting! So it does look like there's some streaming / chunking options for nREPL evals. Maybe I'll make it cap at a save level and you can request the rest if you really need it and are okay waiting for everything to catch up. I've added it to my todo list and will try to address it asap alongside some other things around stdout display.

Olical16:04:47

Turning off pprint will be the best bet for now, but yeah, I'll pick something big that's slow and try to get it evaluating efficiently. The best solution for now would be to wrap anything you know that's got a HUGE result in (do ... nil) I think.

Olical16:04:16

I'll find a way to stop parsing and printing when things get too large and give you the option to request the rest. Somehow.

rafaeldelboni16:04:25

strange is not soooooooooooooooo big is like 65000k lines

Olical16:04:21

Oof, and how many characters? (just count the string without splitting lines)

Olical16:04:40

Ah, I managed to cause a lock up, a small one but still. About 20k lines

Olical16:04:49

(lasted 1-2 seconds)

rafaeldelboni16:04:05

cool, I mean nice that is reproducible

rafaeldelboni16:04:30

probably chunk is a good option

Olical16:04:59

Might write a timing wrapper function or something and try to pin point the delay.

rafaeldelboni16:04:04

CHARACTERS 3862488  SPACE 1531184

Olical16:04:16

Looks like the biggest delay might be in splitting the lines.

rafaeldelboni16:04:31

do you think is possible to conditionally do something? if not I'm fine with sintax off

Olical16:04:13

I think just turning off pprint until I've optimised it is the best bet

Olical16:04:23

I might know why, working on some tweaks now

rafaeldelboni16:04:37

ah, another question, is there a way to clear the buffer?

Olical16:04:54

Although I'll be doing dinner and coming off soon, I'll work on this tomorrow too. I want Conjure to easily handle this kind of output. Maybe a little delay, but it should still be usable.

Olical16:04:11

When I clear the buffer I just open it in a split or tab then dgg, like any old buffer 🙂

rafaeldelboni16:04:52

sure, I still didn't realized that is a normal buffer haha

Olical16:04:47

You can write more code in there and eval it too, it's like a buffer REPL

Olical16:04:31

Updated Aniseed's string splitting algo (Lua doesn't come with a good string split so I had to write my own Clojure like one and it was SLOW)

Olical16:04:41

My repro case is now too fast to notice...

Olical16:04:59

How's yours? I would imagine it'll still lag a bit but should be MUCH better?

rafaeldelboni16:04:38

I will update here

Olical16:04:08

I just poured coffee on aniseed.string/split

rafaeldelboni16:04:22

yeap looks like is solved

rafaeldelboni16:04:18

I will keep testing it on my production apps haha

Olical16:04:46

😱 you mean that huge output is now mostly performant and doesn't lock up vim at all?

Olical16:04:13

(I would expect something that big to slow the buffer down no matter what, it's just huge)

rafaeldelboni16:04:36

yeap, seamlessly

rafaeldelboni16:04:44

but if I do some evals

Olical16:04:47

😍 that worked better than expected

rafaeldelboni16:04:52

after some I have to clean the buffer

rafaeldelboni16:04:00

because is huge anyways

rafaeldelboni16:04:07

computer problems

rafaeldelboni16:04:21

but is really fine now

Olical16:04:33

So the log does trim automatically when it's too long but there's an edge case that you're hitting. I don't trim as well when there's one REALLY big result.

Olical16:04:50

Default config is in the docs, I think it's past 10k lines it is cut to 6k?

rafaeldelboni16:04:52

yeah is a big big map

Olical17:04:04

So if want it to trim more aggressively (depends on your CPU and RAM I guess) you could set it to like trim at 3000 lines down to 1000?

Olical17:04:35

Trimming could maybe be better in that case though :thinking_face:

Olical17:04:39

will make a note

Olical17:04:21

So if you had 50k line result in the buffer, it'll fill the buffer. Then as soon as you eval anything else it'll ALL get deleted. Or do you think just cutting the top off the big result is better :thinking_face:

Olical17:04:51

I kinda think just delete the whole thing, it's too big, and you can see it again with <prefix>v2 to view the 2nd most recent result again.

rafaeldelboni17:04:58

yeap I think delete all will be easier to handle

Olical17:04:33

that way you don't end up with half a form that ruins your highlighting too

rafaeldelboni19:04:01

WDYT about add some information about Piggieback and cider-nrepl in the readme installation part?

rafaeldelboni19:04:52

Very subtle as Tim Pope did in fireplace.vim

Olical19:04:19

Oh you mean about installing those specifically?

Olical19:04:29

I'd probably make it another part of vim help :thinking_face:

rafaeldelboni19:04:48

Or just saying you will have limited options without then

rafaeldelboni19:04:52

What are the functions supported using :ConjurePiggieback (shadow/repl :browser) ?

Olical19:04:41

Any code that returns a repl-envc

Olical19:04:51

Including piggieback or figwheel!

rafaeldelboni19:04:12

I tested auto completion worked quite well

rafaeldelboni19:04:38

But go to definition I get this error

; def (word): my-radical-function
; Unsupported operation: info
; Ensure the CIDER middleware is installed and up to date
; 

rafaeldelboni19:04:18

which is strange because docs works fine

rafaeldelboni19:04:45

; --------------------------------------------------------------------------------
; doc (word): my-radical-function
; -------------------------
; components/my-radical-function
;   aaaaaaaaa

Olical19:04:37

Oh that's because it's lacking cider middleware

Olical19:04:31

Go to def now relies on CIDER, instead of my hacky approach, because it fixes SO many edge cases. I may well add a fallback that doesn't require CIDER soon, it just won't work as well.

👍 4