This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-10
Channels
- # announcements (4)
- # beginners (116)
- # boot (4)
- # calva (63)
- # cider (8)
- # clara (20)
- # cljdoc (10)
- # cljsrn (69)
- # clojure (115)
- # clojure-austin (1)
- # clojure-dev (4)
- # clojure-finland (1)
- # clojure-italy (3)
- # clojure-nl (6)
- # clojure-russia (10)
- # clojure-uk (84)
- # clojurescript (28)
- # cursive (14)
- # data-science (1)
- # datascript (1)
- # datomic (11)
- # duct (3)
- # emacs (13)
- # figwheel-main (11)
- # fulcro (4)
- # graphql (6)
- # jackdaw (2)
- # jobs (23)
- # jobs-rus (1)
- # kaocha (11)
- # lein-figwheel (13)
- # leiningen (55)
- # luminus (14)
- # lumo (22)
- # off-topic (121)
- # pathom (19)
- # re-frame (6)
- # reagent (3)
- # reitit (22)
- # remote-jobs (10)
- # ring-swagger (1)
- # shadow-cljs (67)
- # slack-help (5)
- # spacemacs (1)
- # sql (18)
- # vim (28)
- # yada (2)
Hi! Could you help me please to start with calva? I already have project with next strings in the profiles.clj
{:profiles/dev {:env {:database-url "jdbc:h2:./guestbook_dev.db"}}
:profiles/test {:env {:database-url "jdbc:h2:./guestbook_test.db"}}}
where I have to add repl dependencies?
like this?
{:profiles/dev {:env {:database-url "jdbc:h2:./guestbook_dev.db"}}
:profiles/test {:env {:database-url "jdbc:h2:./guestbook_test.db"}}
:profiles/repl {:plugins [[cider/cider-nrepl "0.19.0"]]
:dependencies [[nrepl "0.5.3"]]}}
Thanks, I've found right way to do it
{:profiles/dev {:env {:database-url "jdbc:h2:./guestbook_dev.db"}
:plugins [[cider/cider-nrepl "0.21.1"]]
:dependencies [[nrepl "0.6.0"]]}
:profiles/test {:env {:database-url "jdbc:h2:./guestbook_test.db"}}}
Yes, that looks right, @maximtop. Check that stuff like Go to definition works. It's the litmus test for if the dependencies are correctly set.
May be I didn't start project correctly?
Instead of lein run
I should execute lein repl
Yes. But nREPL seems to connect, so you probably have a project that includes the nrepl server also for the run
.
No nrepl port file found. (Calva does not start the nrepl for you, yet.) You might need to adjust "calva.projectRootDirectory" in Workspace Settings.
Hooking up nREPL sessions...
Connected session: clj
Terminal created for: Clojure REPL
Figwheel not started:
If you want a cljs repl, start Figwheel from the cljs REPL using:
(require '[figwheel-sidecar.repl-api :as fw])(fw/start-figwheel!)(fw/cljs-repl)
and connect to the app with the browser. Then reconnect Calva.
cljc files will use the clj REPL.
Evaluating file: /Users/maximtop/Documents/projects/guestbook/src/clj/guestbook/core.clj
=> #'guestbook.core/-main
Evaluating file: /Users/maximtop/Documents/projects/guestbook/project.clj
CompilerException java.lang.RuntimeException: Unable to resolve symbol: defproject in this context, compiling:(/Users/maximtop/Documents/projects/guestbook/project.clj:1:1)
I don't know what should happen when you evaluate project.clj
. You don't need to do that anyway.
So, if you bump that cider-nrepl dependency and start the repl with lein repl
, then try evaluate core.clj again.
> @bozhidar: does CIDER inject any tools.namespace
dependencies, or how does that cider-refresh
get powered? I have pointed @sasho.popov at remove-ns
and feel a bit bad about that. A proper refresh is what Calva needs.
On a general note - cider-nrepl
is the only thing that CIDER injects itself (+ the newest version of nREPL). Other plugins might inject extra middleware themselves, using the generic middleware injection mechanism provided by CIDER. I guess Calva should do something similar for VS Code plugins (in case someone wants to build something on top of Calva).
Does this answer the question you had about adding ops, @UHS6PHL31 ?
Yes, with lein repl
calva works basically.
I don't have time to check thoroughly now how smooth is work with clojure in vscode.
Thank you for help
To anyone who is contributing, or considering that, I have pushed a dev
branch where the latest Calva 2 stuff now lives. Unless it is an urgent bug fix for the currently released Calva, please base your contributions off of this branch. I have updated the dev instructions as well, please try the new instructions and let me know if I have gotten them right: https://github.com/BetterThanTomorrow/calva/wiki/How-to-Contribute
@bozhidar There are two major changes, somewhat connected. 1. A REPL window. 2. Jack-in for Leiningen, clj/deps and shadow-cljs. Anyone reading this channel can note that the Jack-in is the most important one for newcomers to Clojure and Calva. But for everyday use the REPL window creates a much better workflow than what we can create with those Terminals that are used today. Both features are highly CIDER inspired, btw. The REPL window is created by @mseddon, and I hope he will be writing about its making, because it is quite the achievement. VS Code has only one integration point for adding such a UI, and that is a WebView. So a LISP lexer and a Clojure editor has been written from scratch. It has enabled a new Paredit as well, which will, in time, make many other Calva features work much more reliably.
😄 Right now everything is very unstable, though. It looked like almost ready to ship a week ago, but now I wonder. The optimist in me (which is impossible to kill) says we’ll soon find just one or two reasons causing the trouble.
Is Calva go to/peak at definition supposed to work with external libraries now? For example I am using Compojure (clean install) and it connects to REPL correctly, when I evaluate handler_test.clj, for example, the linter says Parse error: Unable to resolve symbol: deftest
and Parse error: Unable to resolve symbol: is
and when I choose go to definition I get No definition found for is
I am testing on the automatically generated file:
(ns myproj.handler-test
(:require [clojure.test :refer :all]
[ring.mock.request :as mock]
[myproj.handler :refer :all]))
(deftest test-app
(testing "main route"
(let [response (app (mock/request :get "/"))]
(is (= (:status response) 200))
(is (= (:body response) "Hello World"))))
(testing "not-found route"
(let [response (app (mock/request :get "/invalid"))]
(is (= (:status response) 404)))))
Maybe I am missing some settings in my project.clj?
(defproject myproj "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url ""
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.10.0"]
[compojure "1.6.1"]
[ring/ring-defaults "0.3.2"]]
:plugins [[lein-ring "0.12.5"]]
:ring {:handler myproj.handler/app}
:profiles
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.2"]]}})
Hmm, it depends on what you have in your profiles.clj
, because that project file does not contain the dependencies needed.
Try starting the repl with this command and see if that works:
lein update-in :dependencies conj "[nrepl \"0.6.0\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.2-SNAPSHOT\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- repl
There is this: https://github.com/BetterThanTomorrow/calva/wiki but I think there is some updating needed there.
This might be enough:
{:repl {:plugins [[cider/cider-nrepl "0.21.2-SNAPSHOT"]]
:dependencies [[nrepl "0.6.0"]]}}
Sat with a student trying to get her workflow going, using the "Calva says" evaluation commands rather than "Run selected text" (which goes to the terminal REPL and would be fine if it just didn't echo all of the evaluated code), and couldn't get it working... so I tried to show her on mine and now it doesn't work there either, even in a project for which it did previously. When I "Calva: Evaluate current file" it prints a message to Calva says, saying it's doing it, but then I get a popup that says "Cannot read property 'loadFile' of null". No other "Calva: Evaluate..." commands seem to do anything. Has an update broken this? For the time being we're back to evaluating everything outside of VSCode in terminal repls and the like
@pez that time of year again... https://twitter.com/cljtogether/status/1116057046762135552