This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-20
Channels
- # announcements (8)
- # babashka (19)
- # beginners (100)
- # boot (3)
- # calva (16)
- # cider (8)
- # cljdoc (6)
- # cljsrn (15)
- # clojure (73)
- # clojure-europe (7)
- # clojure-france (1)
- # clojure-italy (12)
- # clojure-nl (11)
- # clojure-sg (1)
- # clojure-uk (17)
- # clojurescript (63)
- # cursive (22)
- # data-science (2)
- # datomic (2)
- # defnpodcast (1)
- # docs (1)
- # fulcro (7)
- # graalvm (8)
- # jackdaw (1)
- # kaocha (11)
- # off-topic (26)
- # pedestal (4)
- # planck (1)
- # re-frame (35)
- # reitit (5)
- # ring (3)
- # shadow-cljs (25)
- # slack-help (11)
- # spacemacs (8)
- # specter (2)
- # tools-deps (61)
- # vscode (6)
- # xtdb (3)
Hi people! I'm trying to get calva to work on a fresh new project using leiningen + figwheel-main but can't seem to get the jack-in to work... I've tried looking for documentation and/or examples but can't seem to find any. Can you guys point me to something I can use to help myself out?
I've tried to stay as close as possible to the just-out-of-the-box setup and from there started adding config... Currently I have a minimal project.clj file
(defproject dn.cp-planning "0.1.0-SNAPSHOT"
:description "Planning application"
:url ""
:license {:name "Eclipse Public License"
:url ""}
:min-lein-version "2.7.1"
:dependencies [[org.clojure/clojure "1.10.1"]
[org.clojure/clojurescript "1.10.597" :exclusions [com.google.errorprone/error_prone_annotations com.google.code.findbugs/jsr305]]
[reagent "0.9.1"]
[re-frame "0.11.0"]
[clj-commons/cljss "1.6.4" :exclusions [args4j]]]
:source-paths ["src"]
:aliases {"fig" ["trampoline" "run" "-m" "figwheel.main"]
"fig:build" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]
"fig:min" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
:profiles {:dev {:dependencies [[com.bhauman/figwheel-main "0.2.3" :exclusions [args4j commons-codec]]
[com.bhauman/rebel-readline-cljs "0.1.4" :exclusions [args4j]]
[devcards "0.2.6" :exclusions [sablono args4j]]]
}})
and then I added this to my vscode project settings.json:
{
"calva.replConnectSequences": [
{
"name": "Leiningen + Figwheel Main",
"projectType": "Leiningen",
"cljsType": "Figwheel Main",
"menuSelections": {
"leinAlias": "fig:build",
"leinProfiles": [
":dev"
]
}
}
]
}
I basically started from lein new figwheel-main dn.cp-planning -- --reagent +lein
running the default jack-in command seems to start the lein+figwheel stuff fine, but in the editor itself it seems to hang on "Launching REPL using Leiningen + Figwheel Main" (that's what it says in the status bar). I've noticed the setup doesn't write an nrepl-port file, so maybe that's what calva is waiting for?
cool, that worked! thanks. If you have the time and energy, could you explain why it didn't work with the alias? I'm new to clj(s) and I'm still trying to make sense of a lot of the new info that's hitting me. The tooling is turning out to be a real head-scratcher for me, so I'm keen to learn and get a better understanding of how stuff works
I can try... 😃 This is not about ClojureScript, but rather about the tooling Calva needs for connecting to the project REPL. Central in this is that a CIDER nREPL server needs to be started that will be Calva's way to speak to your Clojure (and/or ClojureScript) program. To ensure this, Calva's jack-in command starts this server as the main of the program. But since many aliases also has a main argument Calva will, in the presence of an alias, not do it, but rather rely on that the alias starts the nREPL server. This is something that those standard Figwheel main aliases do not do (for very good reasons). Thus, using those aliases will just not work. I'm short of time right now so can't elaborate much more, but all is not lost, hopefully... I try to explain the Jack-in a bit in depth here: https://calva.readthedocs.io/en/latest/jack-in-guide.html
Ok. If I wanted to make a higher-level main function myself that would call both the main method in that alias AND the one that calva expects, what would the main argument for calva be?
If you make the alias call that higher-level function, then that would be used. Calva does not provide a main argument when there is an alias.
That said, I doubt you need an alias. Calva knows about Figwheel Main and will set things up in a similar way that the alias does.
I got that. By disabling the alias I got it to work, I'm just trying to get a better grasp on things 😉