Fork me on GitHub

Has anyone used new Conjure with Figwheel without Leiningen? I have something hacked together but it feels like I'm doing something wrong.


OK. So this is how I've got things working at the moment: I'm not sure if the nrepl.clj file is necessary. It feels like this is something that Figwheel should support (and possibly does) that I simply haven't set up correctly.


This looks good! I do feel like lein-figwheel should be booting an nREPL server for you though :thinking_face:


Oh, it would, I'm sure. I'm just trying to have a workflow that doesn't use Leiningen at all. Call me perverse.


Ah okay! Yeah I don't use lein either, figwheel-main all the way. I think some CLJ projects can have their nREPL started from cmd line args alone, but only for simple cases.


As soon as you start working on a bigger project you tend to move towards a namespace / some in project tools to boot up your nREPL (I also used to add socket prepl code in there when I outgrew propel on projects)


With CLJS, if you're not using shadow, I think you kinda need a bit of code like you have.


Shadow-cljs does just work in my experience so far, I really like it. If you wanna try Conjure and Shadow here's the config I use to test Sets up nREPL and CIDER out of the box 😄


I've hesitated to use Shadow because it feels too much like magic. But maybe that's irrational and no more or less true than Figwheel.


I am getting frustrated that after a couple of hours, I can't get a version of this script working that will call a shutdown hook when it finishes. I don't know what's going on but for some reason when I end the CLJS REPL, the entire thing just stops and nothing more runs.


But in any event, not the fault of Conjure.


Hmm, yeah things like shutdown hooks + CLJS sounds like a bad time, even without trying. A bunch of things that just work with JVM Clojure just don't translate well since you're dealing with weird eval environments that may or may not respond in the right way.


There's so many places and ways CLJS can be evaluated, I think a shutdown hook would be tricky. Or do you mean in JVM land you have a shutdown hook?




I just want to automatically delete the .nrepl-port file.


Ah I see! I guess it's just a case of getting the JVM incantation correct.


Both deleteOnExit and addShutdownHook aren't working so long as I make a call to figwheel.main.api/cljs-eval which feels nuts to me. I've tried everything I can think of (wrapping that call in a future, running it in a separate thread) but nada.


Anyway, it's not a Conjure problem :)


And not even that big a deal to be honest.


Unless it's setting it's own shutdown hook which overrides it? Yeah, deffo not Conjure but still annoying :thinking_face:


Yeah. What I was hoping I could do rather easily was create some middleware that you'd add to your Figwheel project and pass options to like figwheel.main and it would basically do everything it did but just started an nREPL, saved the file for the port and deleted it when you shut it down. Make it as close to 'just works' as it could conceivably be without changing Figwheel itself.


Anyway, sorry for the trouble and sorry for coming at you with all these comments at the last hour. We just hit a five-day weekend in Japan so have more time than usual :)


Well shadow-cljs spits its portfile out into .shadow-cljs/nrepl.port, if figwheel already does something similar (has it's own file) I can add that to the list!


Oh neat! Enjoy the weekend! 😄

👍 4

Conjure supports hunting for multiple kinds of port files, I'll get it to hunt up the dir tree soon too.


I'll make that configurable actually


Oh, well, Conjure works fine. It's just the file might be there and you don't have an nREPL instance running. But that's not the end of the world. Conjure fails gracefully.


If I remove the rebel-readline dependency, the problem disappears! I like rebel-readline but at least I have a sense for where it's coming unstuck now. (Sorry, this isn't relevant to Conjure but I needed to express this relief to someone.)


I'm very glad it works! 😄


I think @dharrigan had an issue with rebel conflicting with the nREPL CLI too


Yeah, I fire up my own nrepl now inside of user.clj


Updated the code I have to run an nREPL in Figwheel without Leiningen: I'm setting the Figwheel configuration option :rebel-readline to false because if I have rebel-readline enabled, the REPL won't shut down cleanly (and if it won't shut down cleanly, it won't call .File.deleteOnExit and remove the .nrepl-port file). If anyone knows if there's a way to fix this, please let me know.


I've borrowed this bit of code...


@dharrigan Cheers! Yeah, I want to use .File.deleteOnExit but using rebel-readline via figwheel.main.api is causing it not to be called for some reason. Problem goes away if I don't use it. It's a bit of a shame because I like it.


np, good luck! 🙂

👍 4

It seems like the default namespace is always user, even if the type of REPL is ClojureScript. Am I wrong to think that it should be cljs.user if it's a ClojureScript REPL? I'm mucking around a bit in a file with no namespace only to find that when I switch to the default Figwheel REPL (that's open in cljs.user), the bindings are over in user (which the Figwheel REPL complains about if I try to switch to because it's a single segment namespace).


Ah good catch! I'll fix that, I think I had it working for both but removed it while refactoring early on.


Another nice thing about being faithful to how stdout in a terminal displays, test output looks just like the terminal!

; --------------------------------------------------------------------------------
; run-ns-tests: dev.sandbox
; Testing dev.sandbox
; Ran 2 tests containing 2 assertions.
; 0 failures, 0 errors.


(that's in cljs)


@mike858 The default namespace for CLJS environments is now cljs.user 🎉

👏 4

@olical Is there a way to change the background colour of the HUD? I have a similar issue to @dominicm (I think) where the colour I use for comments makes it difficult to see output there that's commented out (i.e. docs).


Sorry if this is somewhere in the docs. I had a look but missed it if it was there.


@Olical the HUD uses the virtual window color


Sorry *floating window color


I forget what that defaults to


Normal maybe?


@dominicm Cheers. That's enough to have Google help me work out what to adjust :)


Normal just to highlight it

👍 4

As far as I'm aware it's actually the pop up menu background :thinking_face:


Someone else had an issue with their theme being too light and not having enough contrast.


Added config for which port-files to check for a port, see docs 🙂


(currently .nrepl-port and shadow-cljs' one


Conjure will now hunt up the directory tree for all port files too. So you can change which files get checked and you can connect to them while your CWD is deep within your project.

👍 8

Go to def and load-file also still seem to work if you're in a different Neovim CWD to your REPL.


@dharrigan Added a better fix for the go to def hud flash, it shouldn't appear at all now unless something goes horribly wrong.


fantastic - will check shortly 🙂


Hmm, still flashes


Oh, I know why!


Should be fixed now, I had a second log output I didn't spot


So I need to suppress the HUD when the request comes through from you and also when it completes working out the path.


Since it tells you where it jumped to (which is kinda pointless since you're looking at it). You can still open the log to see the workings out.


(I could never see the flash in the first place, but it might be down to laptop speed and vim settings)


Another flicker bytes the dust


mother flicker...


Well that's my pre-release todo list cleared out again. Might do some more docs.


I've been using the new conjure since Friday and really, it works very very well 🙂


Almost a seamless transistion from old to new.


but far faaaaaster startup 🙂


I'm very glad to hear that! It'd be great to get the interactive :ConjureSchool implemented soon too. One of my visions for this (possibly silly) is for people that are new to Clojure / Lisps that know a little bit of Vim to use this.


I want the out of the box experience to just be "open file, run code", but give you the tools and config to tweak it into the future.


Would be awesome to have beginners using this stuff.


Initially, I thought the "hud" would be annoying


but no. I was very wrong. It's great.


😄 🎉 it can always be turned off too, I put that setting in with you in mind


What abatted my fears was that it disappears on keymovement.


You can also change the size to keep it suuuper small. Size is based on Neovim window size.


Right now it's a little less than half the width and height of your editor.


No I like it - when I eval a form/buffer, I like to see it have a result, then as soon as I move my cursor, puff - like MAGIC it disappears.


magical, conjure 🙂


Yep! So if you're just editing away and not looking it's more of a visual confirmation in your peripheral vision that something happened.


I think I'll probably reintroduce some virtual text stuff at some point too. I think the best use would be function signatures with some simple highlighting, but I'll see.


Would also be cool to maybe flash the code you evaluated or something as confirmation. And also display icons in the gutter that show which lines have been evaluated or changed since last eval (just like CIDER in Emacs). All configurable of course.


All great ideas. I look forward to the next round of development!


Well I'm going to watch the last Mandalorian episode, write more Aniseed docs and thing about the announcement blog post 😄


I enjoyed that series a lot


This isn't a conjure question, but perhaps someone might know. Is there a way to subtly change the background colour of the form block that the cursor is in? To visually show the scope, if you know what I mean, of the block. As you move the cursor up and down, between forms, the subtle background highlight would change shape. I know, presently, that I rest my cursor on an opening, or closing, parens, it shows it's counterpart, but I'm after showing the entire block 🙂


(I'll ask in #vim too)


Ohh that'd be cool. I think it'd be pretty tricky to implement right now, would probably have to be a plugin :thinking_face: (could be implemented with Aniseed and Conjure!) Maybe another thing tree-sitter integration would make absolutely trivial too.


I'm sure this is a solved problem, it's basically highlighting the inside of a block, between matching parens, or curly braces (if javascript for example)


but yeah, probably needs some language awareness


Hmm, you'd need to check the highlight stack (trace?) For a tag saying "you're in a form". Not sure if that exists


Then you'd need to somehow change the highlight of that ONE specific form


By maybe adding some new tag to it, I think that part is doable


Maybe Conjure's form finding code would be enough... I have the code right now to ask "get the form under my cursor and where it starts / stops"


so if you had an autocmd for cursor move


you could luaeval("require('conjure.extract').form()") from vim script


which would return a map with two keys, range and content


then you could use that range to apply a highlight. Although that's where my knowledge ends.


more knowledge than moi 🙂


Could be a fun little plugin that piggiebacks off Conjure's lua public fns!


I kinda want people to write plugins that just reach into Conjure and use stuff


I could try, but later 🙂


Yeah, of course. Just musing about the potential, I really like the idea!


we can talk about this later - let you get on with your conjure stuff 🙂


Updated the code I have to run an nREPL in Figwheel without Leiningen: I'm setting the Figwheel configuration option :rebel-readline to false because if I have rebel-readline enabled, the REPL won't shut down cleanly (and if it won't shut down cleanly, it won't call .File.deleteOnExit and remove the .nrepl-port file). If anyone knows if there's a way to fix this, please let me know.