Fork me on GitHub
#conjure
<
2020-04-17
>
Olical11:04:30

Connected to shadow-cljs and evaluating things 👀

Olical11:04:08

It doesn't seem to like in-ns though, so I just swapped it to ns.

Olical11:04:19

Not sure what the consequences of that will be...

Olical11:04:18

There's some weird stuff here though. If I evaluate a namespace form I get three responses.

Olical11:04:34

nil followed by the namespace name as a symbol twice.

Olical11:04:49

I hope I haven't discovered race conditions etc 😭 it's receiving my code with one id and sending the result back on another id.

Olical11:04:59

Why does everything I touch break.

Olical11:04:56

Only when I evaluate namespace forms.

Olical11:04:33

Also it's mangling file path metadata so I can't go to def. I'll timebox and try to work around some of this then move back onto features.

Olical11:04:04

Added a workaround config so you can prefix all paths for go-to-def. Although there's no real way to know that you have to set it and what to set it to.

Olical11:04:52

Will just have to document it

Olical12:04:27

Found a much better way! Go to def now uses :find which means you get a nice error if it tried to open a file and failed. Then you can just set your Vim path to contain the right source directories.

dominicm13:04:47

The info operation in cider takes care of this iirc

Olical14:04:01

Oh interesting. Maybe I should require CIDER for that feature...

Olical14:04:11

If it's stable across all platforms. Wonder how it works with CLJS

dominicm14:04:41

Well, it's running in the JVM, so it knows what the classpath is!

dominicm14:04:54

So just does (io/resource ...) on it, and then relates that to a file

dominicm14:04:59

not sure what you're doing :)

Olical14:04:13

Just getting it out of meta data, so pretty simple.

dominicm14:04:18

There's problems with using java classpath for vim path.

dominicm14:04:36

(I've tried this before... you're tripping over many of the same things I did!)

Olical14:04:02

I've implemented it a few times now but yeah, maybe CIDER is the way to go

Olical14:04:13

I had zipfiles working with :edit with some hackery

Olical14:04:17

But yeah, won't work with :find

Olical14:04:14

Also, do you know if complete works after piggieback?

Olical14:04:19

Is it that magical?

dominicm14:04:45

I think so, but I'm way less confident :)

Olical14:04:12

No worries, I'm going to describe on connect and then use that to check available features.

Olical12:04:26

So doc, go to def, source lookup all work with shadow.

thheller12:04:50

@olical "mangling file path metadata"? what does that mean?

Olical12:04:16

Sorry, bad word really, I mean that the absoluteness of the path was being lost and became relative to the path of the JVM / CLJS?

Olical12:04:32

Which isn't so bad on it's own really, just made it harder to know how to find that file in the project.

Olical12:04:49

But since you can add to your vim path, that's a nice way to handle it I think so no big deal really!

thheller12:04:12

still don't know which path you are talking about though

Olical12:04:20

Oh sorry! In the meta data of a var.

thheller12:04:42

right, yeah that is always a classpath path, never a fs path

Olical12:04:17

Yep, no biggie really. In CLJ land it took my absolute path and ran with it, but that won't always be the case and that's okay.

Olical12:04:33

The multiple results for the namespace eval is a weirder issue 😅

thheller12:04:00

how did you connect?

Olical12:04:25

Direct to the nREPL port then evaluated (shadow.cljs.devtools.api/nrepl-select :app)

thheller12:04:44

hmm yeah you should only be getting one result

thheller12:04:16

you get multiple because it does multiple async commands and just tells you too much about what it is doing

Olical12:04:16

I'm probably doing something weird since I in-ns before every eval.

thheller12:04:56

let me check the filtering

Olical14:04:44

Would it be bad if I leaned on CIDER even for things like documentation lookup :thinking_face:

Olical14:04:13

WIthout the middleware all you can really do then is evaluate things.

dave15:04:32

i have no objection to that, personally

dave15:04:54

IMO as long as evaluation works without additional middleware, then i'm happy

Olical15:04:42

It'll make it so much easier to provide a good experience, right now I'm taking the easiest hackiest approach to some features. CIDER polishes them and makes them easy to hook into.

dave15:04:32

i feel like that approach makes a lot of sense. standing on the shoulders of giants and whatnot

dominicm15:04:13

long-term, graceful degradation might be OK. Similar to nrepl's completion

Olical15:04:04

Yeah, I'm basically checking for individual ops so if some things are missing that's okay. Maybe I'll have a fallback doc system, it'll just be annoying maintaining two, it's a bug risk imo

dominicm15:04:58

definitely is, yeah

Olical16:04:20

eldoc only works in the jvm it seems 😭

Olical16:04:28

Maybe I'll stick to my hax for that one for now.

Olical16:04:49

Ah no! Wrong session!

Olical16:04:36

Not sure if I should be using eldoc for rendering my own doc output 😬 should probably be using info I guess. But I like the parsed arg lists.

Olical16:04:30

Swapped to info, works quite nicely across CLJ and CLJS.

Olical16:04:21

Also noticed if I did it on add before I defined my add function it returned a list of candidates. So then I log out the possible candidates classes that contain the add method and you can hit K on the one you're interested in.

Olical16:04:38

Or even just delete the /add off the end and get the full class docs.

Olical16:04:36

I'm going to add a couple of commands for figwheel-main and shadow-cljs support out of the box too.

🎉 8
Olical16:04:30

Think I'm done for today though, was a bit slow but beginning to integrate with CIDER properly, deleting my hacky simple attempts at features as I go. Not long until completion at this rate 👀

👍 16
dave19:04:11

Exciting times!