This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-09
Channels
- # announcements (5)
- # babashka (1)
- # beginners (116)
- # calva (139)
- # cider (11)
- # clara (2)
- # clj-kondo (13)
- # clojure (247)
- # clojure-dev (18)
- # clojure-europe (5)
- # clojure-france (2)
- # clojure-italy (2)
- # clojure-nl (7)
- # clojure-spec (24)
- # clojure-uk (34)
- # clojurescript (41)
- # cursive (11)
- # data-science (2)
- # datomic (33)
- # emacs (10)
- # events (3)
- # fulcro (134)
- # graphql (9)
- # jackdaw (3)
- # jobs (1)
- # joker (20)
- # kaocha (3)
- # leiningen (7)
- # luminus (2)
- # malli (3)
- # music (1)
- # pedestal (7)
- # re-frame (25)
- # remote-jobs (7)
- # ring (7)
- # shadow-cljs (85)
- # spacemacs (13)
- # testing (2)
- # tools-deps (60)
- # xtdb (11)
- # yada (7)
It turned out you couldn't completely stop Calva from formatting-as-you-type. But now you can. So Parinfer can do its job, I can't do much about the job Parinfer does though, so I certainly prefer Calva's formatting.
cross-post because I was just referred to this channel! Hey all, new to clojure, coming from node đ. I am trying to use vscode with some goodies (autocompletion, linting, etc.) and then run that file with repl. On each save, re-run this file. This way I get quick feedback loop and can work in familiar environment instead of in terminal. Does this make sense? If not, what are some alternative methods?
@adamfranzen: cross-posting is fine! đ
You can certainly rerun the file on each save. However, I suggest you utilize the power of the Clojure REPL and rather rerun the pieces of code you have changed, in a highly incremental fashion. I try to describe my own way of coding here: https://clojureverse.org/t/why-clojure-by-uncle-bob/4751/5?u=pez
ok, so I am following Something To Try First
from the readme. I have a new directory. I created project.clj. I wrote a function and then run ctrl+alt+c e
and it says Command Calva: Evaluate Current Form
is not enabled int he current context. How do I enable this?
First you'll need to read the section above Something to try first đ https://github.com/BetterThanTomorrow/calva#how-to-connect-calva-to-your-project
So, Calva needs to be connected to your running Clojure application in order to help with evaluations. The easiest way to do it is to let Calva start the app for you. (Search for Jack in in the command palette).
ok, so when it says to open a project, should I create a new project with leiningen?
And, yes, it might be best to create a new project using lein. @brandon.ringe wrote a great short guide for how to get started with Clojure. Let me find it for you.
that gist seems to be perfect. I am running into this issue that seems to not be working like the guide describes. I open the new lein project in code. I open core.clj
and run ctrl+alt+c, ctrl+alt+j
and the terminal appears. Calva appears to be doing it's thing, but then it says Jacking in... Hooking up nREPL sessions... and then it hangs there. Can you help me please?
So I do not need to run lein repl
, correct? I am assuming that calva takes care of starting the repl?
Yeah. So it does that in the integrated terminal. Paste the contents from there here, please. Maybe we can see what is (not) going on.
OK, so I got one step further. Instead of selecting Leiningen
, I selected Leiningen + shadow-clsj
and it is working. Not sure why :man-shrugging:
The project I created was created with lein new project-clojure
, so I would have thought the Leiningen
option would have been correct. Got a repl working though!
I will say that I hacked quite a bit trying to get this working in the past, with lein, and other vscode extensions (which are not removed or disabled), so I fully believe the problem is on my end
But, disabling ask other clojure related extensions should at least be safer. Clojure Lint can be kept, unless you're on Windows.
there is another command
calva connect I think
ok, so getting nREPL to connect using leiningen + shadow-clsj
was one of solution. Here is the error log:
> Executing task: lein update-in :dependencies conj '[nrepl"0.6.0"]' -- update-in :plugins conj '[cider/cider-nrepl"0.22.1"]' -- update-in '[:repl-options :nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- repl :headless <
Warning: implicit middleware found: cider-nrepl.plugin/middleware
Please declare all middleware in :middleware as implicit loading is deprecated.
nREPL server started on port 40403 on host 127.0.0.1 -
ERROR: Unhandled REPL handler exception processing message {:op eval, :code *ns*, :id 1}
java.io.FileNotFoundException: /usr/lib/jvm/java-1.8.0-openjdk-...
do you have anything in your ~/.lein/profiles.clj ?
no that canât be it
can you try to connect without shadow-cljs?
java.io.FileNotFoundException: /usr/lib/jvm/java-1.8.0-openjdk-
I guess there is no java?
I am not sure
does the which java
give you /usr/lib/jvm/java-1.8.0âŠ.
might be related
not sure
thatâs ancient though
I have no idea đ
I'm right now trying to understand how the REPL server can start and then later a complaint about no java....
sdk-man because I am involved in different project demanding different java versions. And skd-man lets me download and switch between java versions at will.
Don't worry about headache. I always learn something new with each new strange problem. đ
Itâs also empty for me đ
as a recap:
- upgraded leiningen to 2.9.1
- completely removed vscode and extensions folder
- fresh reinstall of vscode and calva
- removed openjdk and installed sdk-man
- still getting the same: Jacking in.... Hooking up nREPL sessions....
the connect to repl works?
>sdk list java
================================================================================
Available Java Versions
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
AdoptOpenJDK | | 13.0.0.j9 | adpt | | 13.0.0.j9-adpt
| | 13.0.0.hs | adpt | | 13.0.0.hs-adpt
| | 12.0.2.j9 | adpt | | 12.0.2.j9-adpt
| | 12.0.2.hs | adpt | | 12.0.2.hs-adpt
| | 11.0.4.j9 | adpt | | 11.0.4.j9-adpt
| | 11.0.4.hs | adpt | | 11.0.4.hs-adpt
| | 8.0.222.j9 | adpt | | 8.0.222.j9-adpt
| | 8.0.222.hs | adpt | | 8.0.222.hs-adpt
Amazon | | 11.0.4 | amzn | | 11.0.4-amzn
| | 8.0.222 | amzn | | 8.0.222-amzn
Azul Zulu | | 13.0.0 | zulu | | 13.0.0-zulu
| | 12.0.2 | zulu | | 12.0.2-zulu
| | 11.0.4 | zulu | | 11.0.4-zulu
| | 10.0.2 | zulu | | 10.0.2-zulu
| | 9.0.7 | zulu | | 9.0.7-zulu
| | 8.0.222 | zulu | | 8.0.222-zulu
| | 7.0.232 | zulu | | 7.0.232-zulu
| | 6.0.119 | zulu | | 6.0.119-zulu
Azul ZuluFX | | 11.0.2 | zulufx | | 11.0.2-zulufx
| | 8.0.202 | zulufx | | 8.0.202-zulufx
BellSoft | | 13.0.0 | librca | | 13.0.0-librca
| | 12.0.2 | librca | | 12.0.2-librca
| | 11.0.4 | librca | | 11.0.4-librca
| | 8.0.222 | librca | | 8.0.222-librca
GraalVM | | 19.2.0 | grl | | 19.2.0-grl
| | 19.2.0.1 | grl | | 19.2.0.1-grl
| | 19.1.1 | grl | | 19.1.1-grl
| | 19.0.2 | grl | | 19.0.2-grl
| | 1.0.0 | grl | | 1.0.0-rc-16-grl
| | 14.ea.17 | open | | 14.ea.17-open
| | 13.0.0 | open | | 13.0.0-open
| | 12.0.2 | open | | 12.0.2-open
| | 11.0.2 | open | | 11.0.2-open
| | 10.0.2 | open | | 10.0.2-open
| | 9.0.4 | open | | 9.0.4-open
SAP | | 12.0.2 | sapmchn | | 12.0.2-sapmchn
| | 11.0.4 | sapmchn | | 11.0.4-sapmchn
================================================================================
Use the Identifier for installation:
$ sdk install java 11.0.3.hs-adpt
================================================================================
ok, and I can run lein repl
in the terminal and then Connect to a Runnning REPL in this project
and calva does connect
so explain what the problem was to me like I am five so I can help someone else out in the future
I don't actually know. But it seems something in the installation/configuration caused it to go look for Java's home in the wrong place.
So that message that @dmytro.bunin pointed out told us that. Since you couldn't find any java there either. đ
@adamfranzen @pez I made a small video creating a new lein project on linux and connect using calva. Perhaps we can find out what you are doing differently.
Even if @adamfranzen now has it sorted out. It was something weird with the java install, that sdk-man flew in and took care of.
Now that you've invested so much time on it, you have to give Clojure a good chance, @adamfranzen đ We'll be happy to help with Calva questions here. And if you don't know if it is a Calva or something else question, ask it here anyway.
@c.fehse that is a cool video, thanks for posting! those were the steps that I was taking, so unfortunately the java install/config was not sorted out and seemed to be causing the issue.
@pez absolutely, I am excited to learn! I am going through Clojure for the Brave and True
@adamfranzen Does the lein new <project name>
work?
Okay so there is some sort of java present. But your jack-in process get stuck? (I did not read the complete converstation - sorry)
yes, jack in was getting stuck. I could see that the lein repl server started provided a port number for a split second, then calva would take over to do it's thing, but got stuck at Jacking in.... Hooking up nREPL sessions...
and would never find the server
Can you start a REPL server in the project directory from a terminal with lein repl :headless
- and when it is started just terminate it with ctrl-c
. After that try to connect with calva again?
@c.fehse that does work, but again, the original issue that I was having seems to be resolved. I am curious if that would have resolved the original issue
@adamfranzen I was just asking because a had a similar behavior during my testing - which turned out to be a timing problem in the jack-in process. But don't mind if it is working for you right now it's all good. gg
The timing issue is probably about the filesystem watcher sometimes failing to see the nrepl-port file being created, because for some reason it has been left behind. This used to be a bigger problem before, but I think that sometimes it still happens. Starting the repl and kill it like that is an effective way to delete the port file.
I am trying out this comment approach that I have been reading about. I have this comment in my files and it is saved. Now to call this (comment())
and subsequent functions, how do I do that from repl?
(comment
;;;; These can be eval'd individually in the editor or in the REPL
(bar "test")
(println "hello Clojure")
(+ 1 2 3))