This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-12
Channels
- # announcements (1)
- # aws (1)
- # beginners (182)
- # boot (33)
- # calva (87)
- # cider (3)
- # clj-kondo (2)
- # clojure (108)
- # clojure-dev (73)
- # clojure-europe (2)
- # clojure-italy (27)
- # clojure-nl (22)
- # clojure-norway (1)
- # clojure-spec (1)
- # clojure-uk (122)
- # clojurescript (78)
- # cursive (5)
- # datomic (17)
- # duct (2)
- # emacs (25)
- # events (3)
- # figwheel (1)
- # figwheel-main (1)
- # fulcro (88)
- # kaocha (6)
- # leiningen (2)
- # luminus (1)
- # lumo (4)
- # nrepl (4)
- # off-topic (37)
- # onyx (1)
- # re-frame (35)
- # reagent (1)
- # reitit (4)
- # shadow-cljs (8)
- # spacemacs (22)
- # specter (2)
- # sql (19)
- # tools-deps (12)
- # vim (11)
@lspector , it could be that the cljs repl fails to start in that cljs-quil repl. I have noticed that recently there seems to have changed something in regards to piggieback dependencies. This is why i prefer long beautiful command lines. They are more flexible than configuration buried in projects. But I'll try it myself and fix that project if I understand what is missing.
@somedude314 , if you are connected to a cljs project, Calva creates two repl connections for the editors to use. One for clj files and one for cljs files. So if you are editing a cljs file and do inline evals, it will be the cljs repl that handles the evaluation for you. And for clj files, the clj repl. Cljc files default to clj, but you can toggle it to cljs with a button in the status bar.
Thanks, I had to upgrade a couple of nrepl dependencies and it worked as you described.
Calva also creates two vscode terminals and connect one to the clj repl server and the other to the cljs server. You select which one to use with vscode's terminal selector. (And for the “evaluate in repl terminal” commands calva uses the same logic as for the inline evaluations.)
@lspector, actually, the piggieback dependecies are correct in the project. Something else is going on. You might notice at the terminal prompt where you started the repl and did (fighwheel start)
everything compiles and the app starts, but there is never any cljs-repl prompt appearing. So, even w/o Calva in the picture, something has changed. Totally strange, and you and I are both witnesses that this worked just a week ago. I'll try to figure it out, but right now I am just totally clueless.
@lspector: OK, so I didn't figure it out, but I found a fix that works on my machine. If I bump the figwheel-sidecar
dependency up to 0.5.19-SNAPSHOT
the cljs-repl starts and Calva can connect to it. I can't for the life of me understand why that wasn't needed a week ago, but, hey, at least now we get a cljs repl. I have pushed the change to the repo, so please pull and see if it works out there as well.
About those example code lines to practice how to inline eval in Calva that I put in core.cljs
of that project. I used them the other day when my son asked about the unit circle. He knows that sin(PI/6)
is 1/2, so he started laughing at (Math/sin (/ Math/PI 6)) => 0.49999999999999994
. We then tried it in CLJ and he relaxed when it answered correctly. 😃
Yep. I was using a SNAPSHOT
dependency on cider-nrepl
, which then moved. Now fixed that in the repo, @lspector, so it should stay working now. Totally sorry for the inconvenience I caused.
So, a colleague is exploring Clojure and Calva, which is great, we found a little stumbling block:
> Clojurians, is there a shortcut in Calva to say (in-ns '...)
or do I have to type it out myself?
> I.e. when evaluating a form in the REPL, I would like it to infer what namespace I’m in from the file
He was using Evaluate current form (or selection) in REPL terminal
where he should have used Evaluate current top level form
I guess my point is, (and I see you’ve thought about this too), is that Evaluate current top level form
should be renamed to Calva: evaluate-DWIM
or some such 🙂
Also, the commands for sending forms to the REPL will evaluate them in the namespace of the file, regardless of what namespace the REPL window is using.
paredit.js
uses the name evalDefn
instead of top level. That confused me, so I changed it.
I’ve never looked at the name of these things when I use Cider, as I’ve always just used the keybindings.
C-c C-c runs the command cider-eval-defun-at-point (found in
cider-mode-map), which is an interactive compiled Lisp function in
'cider-eval.el'.
In Calva the evaluation of top level forms take a front seat when it comes to key bindings.
Which may or may not be precise, as I haven’t seen what happens if I do a C-c C-c
on a top-level let-binding 🙂
While I agree that some variation of eval-top-level-form
is technically more correct, eval-current-defn
might make more sense to new-commers
Also I think CIDER does not consider comment forms creating a new top level, by default. Which is a bit strange to me.
I think it risks causing confusion that redefine-current-defn would be the thing to use for evaluating the ns form and whatever top level form. It's not easy to decide about names, always someone will be confused. But certainly, something should be done to ease the path for newcomers.
It doesn't appear to highlight #(...) as comments. Is that something I can enable, or is it not implemented yet?
Also not seeing functions listed in the outline panel. Is that not implemented yet?
I'm just trying it out (been using Emacs). It looks promising so far.
None of that is implemented yet. But you are reminding me about my branch which tries to fix that #_
highlighting. I spent a lot of time on it and I think I might be close even. But, not close enough for release. I should pick it up again: https://github.com/BetterThanTomorrow/calva/blob/wip/grammar-comment-expression/calva/calva-fmt/atom-language-clojure/spec/clojure-spec.coffee
About the outline, I think @alexander.minolta started to look at the symbols listing, which might be related.
I'm guessing you have to parse Clojure yourself and the Clojure compiler gives you no help, the way some compilers have a "language server" or something like that?
Is there a usage guide that explains what I should do to get the happy path? What’s the relation between jackin and connect?
Very good question! I must make that relationship clearer. The answer is that jack-in will also connect you.
hmm does that mean I should also open a repl (like in a terminal window lein repl
) prior to connect/jackin?
Somebody I trust a lot suggested to find another name than Jack-in. What it really does is start the repl server for you, correctly configured for Calva, and then connect. Thing is i am very find of jack-in. It sounds so cool! Maybe I should name Connect a bit more clearly...
If Jack-in works for you, then no need to lein repl anything. But if it's not (and right now it might not work for you) then you need to start the repl yourself and then connect.
Connecting to a remote might become most common use case for connect, but it is not exclusively for that...
(Calva has a bit poor support for remote repls right now, so it probably shouldn't be promoted.)
I found some issues with discoverability when stumbling on blocks using macros in general
Though you might already be aware of it, if not I should probably try to make a minimal reproducable case
The naming is weird on the outside, but defun
is the Emacs Lisp terminology for a top-level form in most languages.
Not sure who decided this was a good idea, but it’s such a strong convention at this point, that it’s extremely unlike it would ever be changed.
It is. And
> The naming is weird on the outside
is telling. Calva is sort of there for people coming from the outside. Fortunately vscode is very good at surfacing functionality based on searching. So I need only include defun
in the command names/descriptions and the insiders will be able to find them. Doing that right now.