This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-15
Channels
- # announcements (1)
- # aws (79)
- # babashka (47)
- # beginners (82)
- # calva (65)
- # cider (27)
- # cljdoc (18)
- # cljs-dev (29)
- # clojure (189)
- # clojure-dev (5)
- # clojure-europe (3)
- # clojure-italy (1)
- # clojure-madison (6)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-uk (41)
- # clojured (3)
- # clojurescript (5)
- # clojurex (17)
- # cursive (30)
- # data-science (7)
- # datomic (17)
- # emacs (3)
- # events (6)
- # fulcro (2)
- # funcool (9)
- # graalvm (29)
- # jobs-discuss (3)
- # joker (3)
- # kaocha (6)
- # malli (5)
- # music (6)
- # off-topic (21)
- # reagent (3)
- # reitit (4)
- # rewrite-clj (8)
- # shadow-cljs (49)
- # spacemacs (7)
- # sql (23)
- # tools-deps (15)
- # vim (43)
- # xtdb (19)
I’ve never manages to get Calva’s “Run Tests” to work - could someone help me debug what I’m doing wrong?
I’m in a namespace that has 2 tests defined using clojure.test/deftest
. And I run Calva Run Tests For Current Namespace
:
Evaluating file: esxi_test.clj
=> #'circleci.vm-service.providers.esxi-test/it-handles-exceptions
Running namespace tests…
No tests found. 😱, ns: 0, vars: 0
Similarly, running all tests:
Running all project tests…
No tests found. 😱, ns: 0, vars: 0
I’m connected with leiningen / nREPL
I doubt you are doing something wrong, @marc-omorain. Rather what is Calva doing wrong here...
I wonder if I don’t have the correct Cider middleware.
“Connect to a running repl in the project” -> leiningen -> localhost -> it picks up the port automatically
So, this fails:
(require 'cider.nrepl.middleware.test)
from when I was looking at reporting the tests to the test panel in VSCode before, I remember that there is an nrepl command to list the current installed middleware. It might be the case that I don’t have the required nrepl middleware loaded, and that we could detect that better by listing the middleware and ensuring that the required ones are loaded
I don’t know what jack-in is 🙂
Bring down the command palette. Type jack-in. The name is really something else, like Start the Project ... or some such.
my service is running in docker using docker-compose, and it exposes the nrepl port to localhost so that I can connect from VSCode. It looks like jack-in starts the project?
Trying out Calva. Im am jacked in, cursor is on a function in a .clj buffer. "Go to definition" says "No definition found for ...". Shouldn't that bring me to the definition of the function in the source?
@marc-omorain If you use jack-in to a local leiningen project, you will get the command line Calva would use to ensure it has the dependencies it needs.
We try to avoid loading code w/o the user's explicit action, b/c it can have quite severe effects. At the same time the dynamic way we find definitions demands that the code is loaded. Haha. But, to we can do better than just refuse to show definitions...
I’m running Calva in debug mode as described in the wiki, with the watcher running. If I change the Calva source code .ts
files in the main VSCode Window, will the debug VSCode window load those changes? Or do I need to stop debugging and start debugging again to make the changes take effect?
hey channel, if I let calva start the nrepl and then open up a cljs file the repl seems to only be looking for clj files. Has anyone seen an issue where cljs files are not even recognized?
so I am following these instructions: https://github.com/nrepl/piggieback#clojure-cli-aka-toolsdeps and it's starting an nrepl. In Calva, I go to "connect to a server in your project" and it fills in the port of the nrepl server but in the bottom next to the nREPL lightning bolt it only has clj
when I try to include a cljs file like lambda/core.cljs
I do (require 'lambda.core)
and it errors with could not find and files named lambda/core.clj
when I start the calva nrepl as well it does the same thing
Yeah. Calva only gives you a window into the the application, you’ll get the same errors. That is a good thing. 😃
To start with, I recommend you do not edit ~/.clojure/deps.edn
, and instead let Calva start the project for you. It will then inject piggieback and such for you.
The command is *Calva: Start a Project REPL and connect*. See here: https://calva.readthedocs.io/en/latest/connect.html
Then it comes down to what kind of ClojureScript project you are trying with. You will need to know that when telling Calva to start the project. Calva supports Figwheel Main, shadow-cljs and lein-figwheel (which is called “Legacy Fighweel” in Calva to discourage using it).
If you are using Clojure CLI/tools.deps I recommend editing ~/.clojure/deps.edn
like is described here: https://github.com/seancorfield/clj-new
oh actually now that you mention that there was a change recently to bring figwheel back in. I'll give that a shot. thanks in advance
If you are just trying things out I recommend the Figwheel Main template: https://rigsomelight.com/figwheel-main-template/
I think our issue is it is trying to start up a repl in the environment that i'm trying to connect to the nrepl in. I went back and tried with Clojure CLI + Figwheel Main and it's now just hanging on the "Jacking in..." phase
2-3 minutes
If you have a REPL running from earlier tries you should probably kill that one first. Then jack-in from Calva.
so it looks like it started a repl in the terminal...
> Executing task: clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/cider-nrepl {:mvn/version "0.22.4"} cider/piggieback {:mvn/version "0.4.1"} com.bhauman/figwheel-main {:mvn/version "0.2.3"}}}' -A:dev <
2019-11-15 14:52:58.735:INFO::main: Logging initialized @4924ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Compiling build dev to "target/node/dev/dev-main.js"
[Figwheel] Successfully compiled build dev to "target/node/dev/dev-main.js" in 5.161 seconds.
[Figwheel] Watching paths: ("src") to compile build - dev
[Figwheel] Starting Server at
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. Node)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
[Rebel readline] Type :repl/help for online help info
Starting node ...
Node output being logged to: target/node/dev/node.log
For a better development experience:
1. Open ... (in Chrome)
2. Click "Open dedicated DevTools for Node"
ClojureScript 1.10.520
cljs.user=>
in deps.edn we have this:
:dev {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}}
:main-opts ["--main" "figwheel.main" "-t" "node" "--build" "dev" "--repl"]}
I see. Maybe you choose the wrong alias. Let me try with a fresh template and I will be able to tell you what you should choose at the prompts.
OK. You shouldn’t use that profile then. Give me a sec, I’ll try myself here first so that I am not misleading you.
okay awesome, thanks so much
I'm gonna run to a 1:1 with my manager but I'll b right back
When Calva asks which builds to start, choose booth dev
and test
. Then choose to connect to dev
.
so dev is a profile and we were just using it as an alias as well?
sorry about the delay
Maybe aliases on tools.deps can be thought of as equivalents to profiles in Leiningen projects…. An alias in tools.deps is sort of an alternative way to instrument the runtime environment. It often contains a main
argument. … But I am the wrong person to answer this, because I haven’t fully wrapped my head around it. But in any case, that :dev
entry you added to your deps.edn
is an alias and using it makes Calva step back and not add it’s own main
arguments, So that particular alias will not work with Calva.
Also. I think the correct sequence to use is to choose no alias, then choose to start the dev
and test
builds. Then choose to connect to dev
.
so I went back and created a new figwheel-main project, should that just work right out of the box with Calva starting it up?
It’s getting late here, so I’ll be abandoning you now. I recommend asking in the channel. Others will probably step in. Also the #beginners channel is awesome.
Yes, the new project should work out of the box if you do not tell Calva to use any aliases.
oh okay no worries. Thank you again for all your help. I'm playing around with a new figwheel and this is making a lot of sense
yep, that works wonderfully
you rock bud, thanks so much!
Dear Calva friends: A new version of Calva is out, v2.0.61. See https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.61 for details, but most of it is about how Paredit behaves in the REPL window. We are sort of preparing for making the Paredit engine we use there be the Paredit engine we us in the editor as well. There are a couple of fixes to our Paredit and the Clojure parser bahind it still to do before we take that step.