Fork me on GitHub
#conjure
<
2020-04-12
>
borkdude11:04:45

@olical I now pushed support for ls-sessions to babashka master. Can you test this?

Olical11:04:48

Should I just be able to brew update && brew upgrade? :thinking_face: not sure if that grabs a slightly older version.

Olical11:04:18

I'm on 0.0.82

borkdude11:04:07

Ah no, sorry, this is not released yet, because I want to see some testing before that. You can use this link for a pre-release:

Olical11:04:21

Wonderful! Thank you!

borkdude11:04:32

The link points to a channel where pre-release links are published

Olical11:04:04

Mostly looking very good. Switching session, cloning and creating fresh ones seems to work (although I haven't checked if fresh / cloned were actually fresh or cloned)

Olical11:04:15

By fresh or clone I mean if I passed a session ID to the clone op or not

Olical11:04:38

The one issue I have (which I need to check if it's just my end) is when I close all sessions in quick succession, nothing seems to happen.

Olical11:04:43

I'll check it with CLJ nREPL

Olical11:04:03

ls-sessions seems to be working well though!

Olical11:04:41

Okay, CLJ nREPL I can close all sessions.

Olical11:04:36

; Sessions (4):
;  1 - 18b5f070-5b94-4381-acd8-2cbd19dbb1ba (current)
;  2 - 5b92247a-683f-4bce-bf19-940a0a0f0220
;  3 - db6173f5-1b36-42e7-8249-a527d213f170
;  4 - e8342e09-da88-4199-bf2a-a66525440bdd
; debug ->
{
  :id "1a441259-e361-4ef2-a16b-bae31909f13f"
  :op "ls-sessions"
}
; debug ->
{
  :id "c738cede-1acb-40a3-8ecc-ebd754859366"
  :op "close"
  :session "18b5f070-5b94-4381-acd8-2cbd19dbb1ba"
}
; debug ->
{
  :id "b733f68a-f40f-472c-a055-b3498c9c1a7d"
  :op "close"
  :session "5b92247a-683f-4bce-bf19-940a0a0f0220"
}
; debug ->
{
  :id "352a4ad8-c09b-4a1c-97f3-a551c608cf05"
  :op "close"
  :session "db6173f5-1b36-42e7-8249-a527d213f170"
}
; debug ->
{
  :id "661bb7bb-3b8d-460d-9352-1ceda0568dc2"
  :op "close"
  :session "e8342e09-da88-4199-bf2a-a66525440bdd"
}
; --------------------------------------------------------------------------------
; Closed all sessions (4)
; debug ->
{
  :id "4319d688-87b6-4a64-a94f-c71c80854d0b"
  :op "clone"
}
; --------------------------------------------------------------------------------
; Assumed session: 9b743e1f-61d9-43bb-93c7-523afb0fc0be
; debug ->
{
  :id "a9c6c10a-6675-4a3e-9f32-fe6dbb20c8ed"
  :op "ls-sessions"
}
; --------------------------------------------------------------------------------
; Sessions (4):
;  1 - 5b92247a-683f-4bce-bf19-940a0a0f0220
;  2 - 9b743e1f-61d9-43bb-93c7-523afb0fc0be (current)
;  3 - db6173f5-1b36-42e7-8249-a527d213f170
;  4 - e8342e09-da88-4199-bf2a-a66525440bdd
sorry it's a lot of output, but I've sent a bunch of closes and I think only one of them registered

Olical11:04:58

This could be a wider issue in how bb handles multiple messages in quick succession?

Olical11:04:57

Pretty cool that my go to definition works though 😄

borkdude11:04:37

Note sure why the sessions aren't closing in quick succession. Does closing just one work?

Olical11:04:27

I'll try to narrow it down

Olical11:04:45

I can close some but not others... or maybe I can only close one before it stops working...

Olical11:04:13

If I don't clone anything I can keep closing and creating a fresh one.

Olical11:04:38

Once I clone a session I can't seem to kill any.

Olical11:04:10

It's like some of them won't die?

Olical11:04:41

It's not a race condition though

Olical11:04:46

Could it be the type of the ID? Some of them are strings, some are UUIDs?

Olical11:04:53

So the disj in close doesn't match them?

borkdude11:04:03

oooh yeah, I've had that problem before. I'll check

Olical11:04:11

Me too, many a time 😄

Olical11:04:30

Feels like that issue to me.

borkdude11:04:28

I think I only use the strings:

(let [id (str (java.util.UUID/randomUUID))]
                   (swap! (:sessions ctx) (fnil conj #{}) id)
                   (send os (response-for msg {"new-session" id "status" #{"done"}}))
                   (recur ctx is os id))

borkdude11:04:58

Also, if it was such an issue, my test should not have passed

borkdude11:04:59

are there any other editors / clojure environments that use ls-sessions so I can test it myself?

Olical12:04:59

I'm really not sure :thinking_face: you can always try Conjure if you have Neovim with a plugin manager but it might be a bit of hassle. All I'm doing is cloning some subsequent sessions then trying to close some.

Olical12:04:08

Trying one more thing

Olical12:04:32

Hmm, okay. Was checking if cloned or fresh sessions behaved differently.

Olical12:04:15

; --------------------------------------------------------------------------------
; Sessions (5):
;  1 - 003fd936-4e7e-429c-aa3d-2245523eb41a
;  2 - 82617ba6-04a0-4dee-9542-1a49a027771c
;  3 - 98a3c464-9a39-42b8-9614-c1fbe37c83b1
;  4 - a40faa48-0958-4712-aaad-efb38fc75dd7 (current)
;  5 - db66665a-5523-46c7-9ebf-890fab6cae20
; --------------------------------------------------------------------------------
; Closed all sessions (5)
; --------------------------------------------------------------------------------
; Assumed session: 2fa9758a-dc49-4564-ba7c-a2c4476c8b02
; --------------------------------------------------------------------------------
; Sessions (5):
;  1 - 003fd936-4e7e-429c-aa3d-2245523eb41a
;  2 - 2fa9758a-dc49-4564-ba7c-a2c4476c8b02 (current)
;  3 - 82617ba6-04a0-4dee-9542-1a49a027771c
;  4 - 98a3c464-9a39-42b8-9614-c1fbe37c83b1
;  5 - db66665a-5523-46c7-9ebf-890fab6cae20

borkdude12:04:53

can you run bb with BABASHKA_DEV=true bb --nrepl-server to see if your close message do arrive?

borkdude12:04:33

I assume you check the reply of the close requests, or do you not?

Olical12:04:09

Yep, the replies are what clean up the callbacks in my state.

Olical12:04:18

I see all close messages in bb with debug on

Olical12:04:33

I can match the session ID up to one that is still in ls-sessions after I asked it to close

Olical12:04:04

"Received" {:id "f2b118d6-2a41-41bd-a135-35155cb85f1c", :op :ls-sessions}
Reading! ea7d375c-944e-43d1-a174-4fe5236dd087 0
"Received" {:id "2ff43e04-814e-4b27-8a3f-6286b186f821", :op :close, :session "0c1d815c-b387-49d5-8541-77155257f4f1"}
Reading! ea7d375c-944e-43d1-a174-4fe5236dd087 104
"Received" {:id "9bfd95d4-379f-4e16-974f-5185937f01aa", :op :close, :session "40f6d2a9-882d-4624-ac36-cf60aa59f10b"}
Reading! ea7d375c-944e-43d1-a174-4fe5236dd087 312
"Received" {:id "2f41872f-4c99-4959-b381-717b7a4780f9", :op :close, :session "6d306267-e21c-485d-bc37-1f2253a3a324"}
Reading! ea7d375c-944e-43d1-a174-4fe5236dd087 208
"Received" {:id "d2640738-1d32-413a-bbc7-308c1937a930", :op :close, :session "97e45296-9ee3-4c2d-8c85-264e3ecf6612"}
Reading! ea7d375c-944e-43d1-a174-4fe5236dd087 160
"Received" {:id "70343c3e-818e-4535-9fd0-81b23782534b", :op :close, :session "ea7d375c-944e-43d1-a174-4fe5236dd087"}
Reading! ea7d375c-944e-43d1-a174-4fe5236dd087 56
"Received" {:id "bfe0c3d6-c07d-4e16-8450-14788a4dc5a8", :op :clone}
Cloning!
Reading! c9092576-8175-4fcd-a256-6e8d4d21e3d2 0
"Received" {:id "3171e89a-1a39-4d04-8948-06b915a319cd", :op :ls-sessions}
Reading! c9092576-8175-4fcd-a256-6e8d4d21e3d2 0

borkdude12:04:01

I'll extend the test with some more sessions at a time

Olical12:04:22

Yeah, I think you need a few to trigger it :thinking_face:

Olical12:04:12

Ah sessions in bb are literally just another way to do :id really?

Olical12:04:27

Because they're all in the same thread etc (this is okay, just understanding what's going on)

borkdude12:04:46

I think I have reproduced the problem, wait a minute

👏 4
borkdude12:04:20

Fixed on master. Can you try this?

$ git clone  --recursive
$ cd babashka
$ BABASHKA_DEV=true clojure -A:main --nrepl-server
to test it?

Olical12:04:19

Looks good!

borkdude12:04:01

Thanks for testing 🙂

Olical12:04:13

Saw the commit too, makes sense!

Olical12:04:18

No problem! Glad it works now.

Olical12:04:56

I guess sessions don't have the same power as in JVM land where they're all separate threads with thread local bindings you can clone to child sessions etc, but it's still nice to have the API work like the others. Great work!

borkdude12:04:45

babashka does have threads, so that could be functionality to implement, I think I just haven't used it that much

borkdude12:04:19

and what doesn't work is interrupt, because babashka doesn't have Thread stop, that method is deprecated and the GraalVM engineers don't support it

Olical12:04:20

Well now the outer API is in line with the other implementations, so if they eventually got their own threads and interrupts it would just work I guess.

Olical12:04:26

Ohh interesting!

borkdude12:04:57

As an alternative I could just kill the entire server, but I'm not sure if that's a good alternative

borkdude12:04:36

I guess you can just eval (System/exit 1) if you want to kill the server

Olical12:04:28

Yeah, that's true. You could run sub bb instances in each session that get killed 😅 (no)

borkdude11:04:05

or tell me how I can test this 🙂

Olical11:04:27

I'm on it 😄

Olical11:04:40

bb nREPL QA team reporting in.

The Continium11:04:03

Hi @olical - if you need some more early testing / feedback of the new version I can help out.

Olical11:04:56

Thanks a lot! I'm working on docs and the final essential features today / tomorrow, so hopefully it'll be in a usable state very soon! I'm just lacking a few niceties like autocompletion at the moment.

The Continium11:04:34

Great - I’ll keep an eye on the channel and switch over when you are done; I can also update https://github.com/thecontinium/asyncomplete-conjure.vim when you are ready.

Olical11:04:55

Nice, I'll try to keep autocompletion working in near enough exactly the same way.

Olical11:04:07

I'll do the same for deoplete and maybe poke the coc-conjure one too.

Olical11:04:40

I'll try to get the autocomplete switch over smooth, make sure they all work on their respective develop branches before I release the rewrite.

The Continium11:04:12

ok - just give me the nod and I’ll update.

rafaeldelboni13:04:18

please update the coc-conjure 🙂

Olical14:04:46

I'll make sure all autocompletion things work before releasing it generally 😄

Olical12:04:44

Rather than a text based help intro I think I'll have a small Fennel based tutorial you can interact with :thinking_face: then at the end of it, it will point you at the docs to work out how to configure mappings etc.

👍 12
Olical14:04:35

Did a bunch of work to improve Fennel / Aniseed evaluation so I can provide a nice out of the box eval tutorial where you actually run Lisp in Neovim. Functions that return multiple results now display all of them in the log, anything printed to out is captured and printed in the log and it uses the Aniseed version bundled with Conjure by default. So you don't need Aniseed installed to evaluate fennel code in .fnl buffers. You can change the config to a global copy of Aniseed if there's a newer version and Conjure is behind or something. Kinda irrelevant to the Clojure world but useful for the initial tutorial buffer that you get to play around in!

Olical15:04:26

https://asciinema.org/a/0zo8XZK2Rxm5vKiGgqLhjzBjp just playing about with the idea for now, but I think this will be the way you get introduced to all mappings and how this sort of eval experience works. Through actually doing it.

Olical15:04:47

You can try this yourself now too if you want, it'll at least test if the Fennel eval stuff works out of the box for everyone 😅 it might explode...

Olical15:04:17

I'm going to add more lesson steps that you work through, teaching you root form, current form, word under cursor, doc lookup, eval at mark.

Olical15:04:05

The text it generates is dynamic, so it'll respect the mappings you've set. Could be useful to refresh your memory on your mappings if you forget.

Olical15:04:30

It's really aimed at all levels, so will feel a little too hand hold-y for some, but I want it to help people who have never evaluated stuff like this get the grasp of it.