<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged calva</title>
<link>https://ask.clojure.org/index.php/tag/calva</link>
<description></description>
<item>
<title>How can I make Calva use a relative path when loading a file in cljs?</title>
<link>https://ask.clojure.org/index.php/14129/how-can-make-calva-use-relative-path-when-loading-file-in-cljs</link>
<description>&lt;p&gt;Is there a way to make &lt;code&gt;Calva: Load/Evaluate Current File and its Requires/Dependencies&lt;/code&gt; use a relative path for ClojureScript instead of an absolute path?&lt;/p&gt;
&lt;p&gt;I'm connecting to a docker container repl for development and the app is running at &lt;code&gt;/app&lt;/code&gt; inside the container. Loading the current file in Clojure works as expected and evaluating things that have already been loaded in ClojureScript works as expected. Loading the current file in ClojureScript fails because it uses the host machine's full path. I get the following error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;; ------ REPL Error while processing ---------------------------------------------
; (cljs.core/load-file &quot;/home/bmaddy/.../model/user.cljc&quot;)
; FileNotFoundException: /home/bmaddy/.../model/user.cljc (No such file or directory)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following all work in the cljs repl as expected:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; absolute path inside the container
(cljs.core/load-file &quot;/app/src/.../model/user.cljc&quot;)
[]
;; relative path from project folder
(cljs.core/load-file &quot;./src/.../model/user.cljc&quot;)
[]
(cljs.core/load-file &quot;src/.../model/user.cljc&quot;)
[]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I see there are &lt;code&gt;JACK_IN_PROJECT_ROOT_PATH&lt;/code&gt; and &lt;code&gt;calva.replConnectSequences.projectRootPath&lt;/code&gt; settings, but they don't seem to affect this.&lt;/p&gt;
&lt;p&gt;Some version info:&lt;br&gt;
Calva version used: &lt;code&gt;v2.0.474&lt;/code&gt;&lt;br&gt;
clojure-lsp version used: &lt;code&gt;2024.08.05-18.16.00&lt;/code&gt;&lt;br&gt;
VSCode Version: &lt;code&gt;1.93.1&lt;/code&gt;&lt;br&gt;
OS: Linux&lt;/p&gt;
</description>
<category>Calva</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14129/how-can-make-calva-use-relative-path-when-loading-file-in-cljs</guid>
<pubDate>Mon, 23 Sep 2024 18:35:32 +0000</pubDate>
</item>
<item>
<title>Refresh/Reload deps.edn changes in Calva + VS Code in WSL Ubuntu</title>
<link>https://ask.clojure.org/index.php/14054/refresh-reload-deps-edn-changes-in-calva-vs-code-in-wsl-ubuntu</link>
<description>&lt;p&gt;Hi, I am new to Clojure and am following &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.youtube.com/watch?v=LqVyP_EGKqw&amp;amp;list=PLRGAFpvDgm2ylbXYIjvu3kI426zAP_Lqc&amp;amp;index=1&quot;&gt;this tutorial&lt;/a&gt; to make a Clojure API. This uses Cursive plugin in IntelliJ, but I am using Calva in VS Code.&lt;/p&gt;
&lt;p&gt;This is my project structure: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt; .
├── deps.edn
├── resources
│   └── config.edn
└── src
    └── clojure_api
        ├── config.clj
        └── core.clj
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;My &lt;code&gt;config.clj&lt;/code&gt; file contents:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns clojure-api.config
    (:require [aero.core :as aero]
            [clojure.java.io :as io]))

(defn read-config []
  (-&amp;gt; &quot;config.edn&quot;
      (io/resource)
      (aero/read-config)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I changed my deps.edn file to add the paths &lt;code&gt;src&lt;/code&gt; &amp;amp; &lt;code&gt;resources&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:deps {aero/aero {:mvn/version &quot;1.1.6&quot;}} :path [&quot;resources&quot; &quot;src&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;while keeping the &lt;code&gt;config.edn&lt;/code&gt; file an empty map: &lt;code&gt;{}&lt;/code&gt;. However, I could not read the config file from &lt;code&gt;read-config&lt;/code&gt; function in &lt;code&gt;config.clj&lt;/code&gt;. It gave this error in Calva repl: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;; Execution error (IllegalArgumentException) at aero.core/read-config-into-tagged-literal (core.cljc:194).
; Cannot open &amp;lt;nil&amp;gt; as a Reader.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The tutorial &lt;a rel=&quot;nofollow&quot; href=&quot;https://youtu.be/LqVyP_EGKqw?list=PLRGAFpvDgm2ylbXYIjvu3kI426zAP_Lqc&amp;amp;t=421&quot;&gt;solved this error&lt;/a&gt; in Cursive by refreshing the project structure. I cannot seem to find any such commands in Calva. How can I update/refresh my project structure in Calva so that the &lt;code&gt;deps.edn&lt;/code&gt; changes are reflected in the repl?&lt;/p&gt;
&lt;p&gt;I have tried to restart the repl, reopening the folder in VS code, shuffling the &lt;code&gt;resources&lt;/code&gt; directory around to no avail.&lt;/p&gt;
&lt;p&gt;I could not find related answers to this problem after googling, so any help will be appreciated. &lt;/p&gt;
</description>
<category>Calva</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14054/refresh-reload-deps-edn-changes-in-calva-vs-code-in-wsl-ubuntu</guid>
<pubDate>Mon, 19 Aug 2024 15:16:49 +0000</pubDate>
</item>
<item>
<title>Feature Request for Clojure CLI: Treat empty deps.edn the same way as a non-existing one</title>
<link>https://ask.clojure.org/index.php/12572/feature-request-clojure-treat-empty-deps-same-non-existing</link>
<description>&lt;p&gt;When &lt;code&gt;clojure&lt;/code&gt; is called from a directory with an empty &lt;code&gt;deps.edn&lt;/code&gt; it exits with a non-zero value. I wonder if it could be considered to treat that situation the same as when there is no deps.edn file at all?&lt;/p&gt;
&lt;p&gt;This would be improve the Calva Ux a great deal. Calva defaults to start clojure-lsp at activation. One  activation trigger is that a Clojure file is opened. Creating a deps.edn file in VS Code will create it as an empty file which the user then can edit. When clojure-lsp starts because of the file creation, clojure is called by clojure-lsp to figure out the classpath. If the file is still empty by then, the command fails, and no clojure-lsp for the user in that session.&lt;/p&gt;
&lt;p&gt;It gets extra important for beginners with Clojure, who we want to instruct how to create a minimal deps.edn project and use a Clojure editor to connect to the REPL. As it is now the instructions get complicated.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12572/feature-request-clojure-treat-empty-deps-same-non-existing</guid>
<pubDate>Thu, 19 Jan 2023 21:48:27 +0000</pubDate>
</item>
<item>
<title>Is there a way to place the elements of a collection vertically with Calva?</title>
<link>https://ask.clojure.org/index.php/12126/there-way-place-elements-collection-vertically-with-calva</link>
<description>&lt;p&gt;I would like to know if i can pass from this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[[1 2 3] [4 5 6] [7 8 9]]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;..to this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[[1 2 3]&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[4 5 6]&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[7 8 9]]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;with Calva or another vscode shortcut instead of having to press enter in each item?&lt;/p&gt;
&lt;p&gt;Thanks in advance! :)&lt;/p&gt;
</description>
<category>Calva</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12126/there-way-place-elements-collection-vertically-with-calva</guid>
<pubDate>Thu, 25 Aug 2022 02:22:23 +0000</pubDate>
</item>
<item>
<title>Calva project type: shadow-cljs vs deps.edn + shadow-cljs?</title>
<link>https://ask.clojure.org/index.php/11901/calva-project-type-shadow-cljs-vs-deps-edn-shadow-cljs</link>
<description>&lt;p&gt;Hi everyone, I’ve gone through the shadow-cljs quickstart guide in the GitHub repo README and got the desired message in the browser console. Next, I wanted to introduce &lt;code&gt;deps.edn&lt;/code&gt; to the project. I had some (self-inflicted) difficulty in jacking in after adding  &lt;code&gt;deps.edn&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;System details:&lt;br&gt;
OS: WSL2&lt;br&gt;
Java version: OpenJDK 11.0.15&lt;br&gt;
Clojure CLI version: 1.11.1.1113&lt;/p&gt;
&lt;p&gt;With only &lt;code&gt;shadow-cljs.edn&lt;/code&gt; in the project, said file contents are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; shadow-cljs.edn
{:source-paths [&quot;src/dev&quot;
                &quot;src/main&quot;
                &quot;src/test&quot;]
 :dependencies []
 
 :dev-http {8080 &quot;public&quot;}
 :builds {:frontend {:target :browser
                     :modules {:main {:init-fn acme.frontend.app/init}}}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At this point, jacking in with Calva using the “shadow-cljs” project type, which both starts and connects to the “:frontend” build, works like a charm. &lt;/p&gt;
&lt;p&gt;As mentioned in the first paragraph, I had difficulty with introducing &lt;code&gt;deps.edn&lt;/code&gt; to the project.&lt;/p&gt;
&lt;p&gt;Add &lt;code&gt;deps.edn&lt;/code&gt; to the main project directory with the following contents:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; deps.edn
{:paths [&quot;src/main&quot;
&quot;src/dev&quot;
&quot;src/test&quot;]

 :aliases
 {:cljs {:extra-deps {thheller/shadow-cljs {:mvn/version &quot;2.19.0&quot;}}}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change &lt;code&gt;shadow-cljs.edn&lt;/code&gt; to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; ;; shadow-cljs.edn
    
 {:deps {:aliases [:cljs]}
        
:dev-http {8080 &quot;public&quot;}
        
:builds {:frontend {:target :browser
:modules {:main {:init-fn acme.frontend.app/init}}}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Jacking in with Calva using the “deps.edn + shadow-cljs” project type at this point leads to an error containing “Failed starting cljs repl for build: :frontend. Is the build running and connected?” &lt;/p&gt;
&lt;p&gt;The Calva Connection Log also provides information, including: “shadow-cljs has not been started yet!” and “If you have a shadow-cljs server or watch running then you are not connected to that process.”&lt;/p&gt;
&lt;p&gt;The build doesn’t seem to have been started. What if we run &lt;code&gt;npx shadow-cljs watch frontend&lt;/code&gt; and then tried connecting to the REPL? Same error messages as before.&lt;/p&gt;
&lt;p&gt;It turns out I should’ve instead kept using the “shadow-cljs” project type (in which case the addition of &lt;code&gt;deps.edn&lt;/code&gt; goes down without a hitch).&lt;/p&gt;
&lt;p&gt;This leads me to wonder:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When to use which project type?  &lt;/li&gt;
&lt;li&gt;Which is preferred for a fullstack&lt;br&gt;
project?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks to Peter and contributors for Calva!&lt;/p&gt;
</description>
<category>Tools</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11901/calva-project-type-shadow-cljs-vs-deps-edn-shadow-cljs</guid>
<pubDate>Sat, 21 May 2022 19:46:14 +0000</pubDate>
</item>
<item>
<title>Calva: Is there an option to add additional parameters when using &quot;jack-in&quot; in Calva</title>
<link>https://ask.clojure.org/index.php/11894/calva-there-option-additional-parameters-when-using-calva</link>
<description>&lt;p&gt;I was playing around with fulcro &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/fulcrologic/fulcro-template#the-api-server&quot;&gt;https://github.com/fulcrologic/fulcro-template#the-api-server&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the readme of the fulcro-template, it said &lt;code&gt;clj -A:dev -J-Dtrace -J-Dguardrails.enabled=true&lt;/code&gt;  to start a backend server. And use any editor that has REPL integration, like Cursive.&lt;/p&gt;
&lt;p&gt;I can start repl using calva jack-in, but how can I add additional parameters like &lt;code&gt;-J-Dtrace -J-Dguardrails.enabled=true&lt;/code&gt;&lt;/p&gt;
</description>
<category>Calva</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11894/calva-there-option-additional-parameters-when-using-calva</guid>
<pubDate>Wed, 18 May 2022 12:04:21 +0000</pubDate>
</item>
<item>
<title>Calva: Is there a way to evaluate a whole file?</title>
<link>https://ask.clojure.org/index.php/11892/calva-is-there-a-way-to-evaluate-a-whole-file</link>
<description>&lt;p&gt;Beside selecting the whole file and then evaluating the selection, can I evaluate the whole file in a more convenient way?&lt;/p&gt;
&lt;p&gt;Adapted from questions asked in the &lt;code&gt;#calva&lt;/code&gt; channel at &lt;a rel=&quot;nofollow&quot; href=&quot;http://clojurians.net/&quot;&gt;Clojurians Slack&lt;/a&gt;.&lt;/p&gt;
</description>
<category>Calva</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11892/calva-is-there-a-way-to-evaluate-a-whole-file</guid>
<pubDate>Tue, 17 May 2022 14:33:43 +0000</pubDate>
</item>
<item>
<title>How to get Clojurescript REPL in Calva (Lein + Figwheel main)</title>
<link>https://ask.clojure.org/index.php/11759/how-to-get-clojurescript-repl-in-calva-lein-figwheel-main</link>
<description>&lt;p&gt;Hi, I trying to setup editor for Clojure, currently struggling with Calva. I have fullstack project (cljs via Figwheel main) and whe I run repl (jack-in) then both repls get started (Lein + Figwheel Main config), but I cant switch to cljs repl, geting error &quot;Cannot read properties of null (reading 'switchNS')&quot;&lt;/p&gt;
</description>
<category>Calva</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11759/how-to-get-clojurescript-repl-in-calva-lein-figwheel-main</guid>
<pubDate>Tue, 12 Apr 2022 04:27:18 +0000</pubDate>
</item>
</channel>
</rss>