This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-02
Channels
- # announcements (7)
- # aws (3)
- # babashka (132)
- # beginners (38)
- # calva (3)
- # chlorine-clover (6)
- # clara (1)
- # clj-kondo (20)
- # cljs-dev (24)
- # cljsrn (9)
- # clojure (76)
- # clojure-dev (1)
- # clojure-germany (4)
- # clojure-india (2)
- # clojure-uk (24)
- # clojurescript (15)
- # conf-proposals (1)
- # conjure (114)
- # cursive (3)
- # fulcro (63)
- # graalvm (1)
- # helix (2)
- # joker (10)
- # juxt (1)
- # local-first-clojure (2)
- # meander (9)
- # off-topic (97)
- # rdf (4)
- # re-frame (7)
- # reagent (16)
- # reitit (1)
- # rum (9)
- # shadow-cljs (48)
- # spacemacs (3)
- # tools-deps (3)
- # vim (30)
- # xtdb (10)
Has anyone used new Conjure with Figwheel without Leiningen? I have something hacked together but it feels like I'm doing something wrong.
Ah, I should probably be using :ConjurePiggieback
: https://github.com/Olical/conjure/blob/647aa152726e86e686be20bfee3bc5294630dc85/doc/conjure-client-clojure-nrepl.txt#L49-L58
OK. So this is how I've got things working at the moment: https://gist.github.com/pyrmont/73d10c74d14f26772fd276c38ee3490d
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 https://github.com/Olical/conjure/blob/develop/shadow-cljs.edn 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.
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?
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.
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!
Conjure supports hunting for multiple kinds of port files, I'll get it to hunt up the dir tree soon too.
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 think @dharrigan had an issue with rebel conflicting with the nREPL CLI too
Updated the code I have to run an nREPL in Figwheel without Leiningen: https://gist.github.com/pyrmont/73d10c74d14f26772fd276c38ee3490d
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
and remove the .nrepl-port
file). If anyone knows if there's a way to fix this, please let me know.
@dharrigan Cheers! Yeah, I want to use
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.
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.
@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).
Someone else had an issue with their theme being too light and not having enough contrast.
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.
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.
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)
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.
You can also change the size to keep it suuuper small. Size is based on Neovim window size.
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.
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.
Well I'm going to watch the last Mandalorian episode, write more Aniseed docs and thing about the announcement blog post 😄
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 🙂
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)
Hmm, you'd need to check the highlight stack (trace?) For a tag saying "you're in a form". Not sure if that exists
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"
to eval this https://github.com/Olical/conjure/blob/899fd63cafdc0d93c223423322b01fdf702467fe/fnl/conjure/extract.fnl#L47-L72
then you could use that range to apply a highlight. Although that's where my knowledge ends.
Updated the code I have to run an nREPL in Figwheel without Leiningen: https://gist.github.com/pyrmont/73d10c74d14f26772fd276c38ee3490d
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
and remove the .nrepl-port
file). If anyone knows if there's a way to fix this, please let me know.