You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,10 @@ Changes to Calva.
4
4
5
5
## [Unreleased]
6
6
7
+
## [2.0.530] - 2025-09-22
8
+
9
+
-[Make shadow-cljs runtimes status update with connection status](https://github.com/BetterThanTomorrow/calva/issues/2928)
10
+
7
11
## [2.0.529] - 2025-09-21
8
12
9
13
- Fix: [No `node-repl` and `browser-repl` builds available with **deps.edn + shadow-cljs** project types](https://github.com/BetterThanTomorrow/calva/issues/2929)
Copy file name to clipboardExpand all lines: docs/site/shadow-cljs.md
+49-11Lines changed: 49 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,9 @@ search:
5
5
boost: 7
6
6
---
7
7
8
-
Calva supports most any JVM hosted ClojureScript environment (and some others, including SCI based, too), but shadow-cljs gets some special treatment to try make it extra convenient to use.
9
-
10
-
With many shadow-cljs projects, Calva's _connect project type_**shadow-cljs**, is the right choice. Projects that use Leiningen or deps.edn can be used both with the **Leiningen/deps.edn**_and_**shadow-cljs** type, depending on configuration see [below](#shadow-cljs-in-full-stack-projects) for more on this.
8
+
Calva supports most any JVM hosted ClojureScript environment (and some others, including SCI based, too), but [shadow-cljs](https://github.com/thheller/shadow-cljs) gets some special treatment to try to make it extra convenient to use.
11
9
10
+
With many shadow-cljs projects, Calva's _connect project type_**shadow-cljs**, is the right choice. Projects that use Leiningen or deps.edn can be used both with the **Leiningen/deps.edn**_and_**shadow-cljs** type, depending on configuration, see [below](#shadow-cljs-in-full-stack-projects) for more on this.
12
11
13
12
# shadow-cljs - browser quickstart
14
13
@@ -29,30 +28,69 @@ Here's how you start a shadow-cljs ClojureScript REPL and connect Calva with the
29
28
1. Open http://localhost:8020/ in the browser
30
29
1. Open browser.cljs file and load it in the REPL: **Calva: Load/Evaluate Current File and Dependencies**
31
30
32
-
Now you can should be able to evaluate forms, e.g.:
31
+
Now you should be able to evaluate forms, e.g.:
33
32
34
33
* The current form or selection with <kbd>ctrl</kbd>+<kbd>enter</kbd>, or
35
34
* Top-level forms with <kbd>alt/option</kbd>+<kbd>enter</kbd>.
36
35
37
36
(See [Code Evaluation](evaluation.md))
38
37
39
-
# Runtime Selection
38
+
# shadow-cljs Runtimes
39
+
40
+
A shadow-cljs Runtime is an instance of your app that connects to shadow-cljs. When Calva connects to a runtime, that's where your ClojureScript REPL evaluations run.
41
+
42
+
```
43
+
Calva <-talks to-> shadow-cljs server <-talks-to-> App (Runtime)
44
+
```
40
45
41
-
When working with shadow-cljs projects you often have multiple runtimes running in different browser tabs, browsers, and phones, simultaneously. Calva will automatically connect to one of these (whichever runtime shadow-cljs connects when selecting a build). And you can then also switch between different JavaScript runtimes without reconnecting the REPL.
46
+
We call the **App (Runtime)** in this diagram *the currently connected runtime*, and sometimes *the active runtime*.
42
47
43
-
## Available Runtimes
48
+
When working with shadow-cljs projects you often have multiple runtimes running simultaneously across different browsers, tabs, and devices. Calva automatically connects to one runtime initially and lets you switch between them. It also detects when runtimes connect or disconnect.
44
49
45
-
Use the command **Calva: Select Shadow CLJS Runtime** to see all currently connected runtimes, presented in a VS Code quick-pick menu. The status bar will also display the active runtime when connected to a shadow-cljs project, and clicking this indicator will open the runtimes menu.
50
+
## Available runtimes
46
51
47
-
## Switching Runtimes
52
+
Use the command **Calva: Select Shadow CLJS Runtime** to see all runtimes that are currently connected to shadow-cljs. The runtimes will be presented in a VS Code quick-pick menu. The status bar will also display the active runtime, and clicking this indicator will open the runtimes menu.
53
+
54
+
## Switching runtimes
48
55
49
56
The **Calva: Select Shadow CLJS Runtime** menu will also let you select which runtime the `cljs` repl is connected to.
Calva reacts to notifications from shadow-cljs about runtimes that connect to the server:
63
+
64
+
If no runtime is connected to Calva and a new runtime connects to shadow-cljs:
65
+
66
+
**Calva will connect to this new runtime*
67
+
68
+
If Calva is connected to a runtime that disconnects from shadow-cljs:
69
+
70
+
**Calva will have no connected runtime*. Even if there are more runtimes connected to shadow-cljs, you'll need to initiate a connection and select a new runtime manually.
71
+
72
+
!!! Note "Reload scenarios supported"
73
+
74
+
Note that this means that if you have the app running in browser tabs **A**, **B**, and **C**, with Calva connected to **A**, and you reload browser tab **A**:
75
+
76
+
* *Calva will “reconnect” to **A***
77
+
78
+
But if you just close **A**:
79
+
80
+
* *Calva will not automatically connect to **B**, nor **C***
81
+
82
+
And if you, while disconnected, start the app on the iPhone **D**:
83
+
84
+
* *Calva will connect **D***
85
+
86
+
!!! Note "Code hot reload"
87
+
88
+
Also note that the connection we're talking about here is Calva's connection to the app's REPL. shadow-cljs hot reloading of code when a file is saved always happens in all runtimes for all apps that are built from the code of that file. Calva is not involved in this mechanism.
89
+
90
+
53
91
# shadow-cljs in full stack projects
54
92
55
-
**shadow-cljs** is a bit special in regards to Calva REPL connection. Mainly because you can start **shadow-cljs** and it's nREPL server in two ways:
93
+
**shadow-cljs** is a bit special in regards to Calva REPL connection. Mainly because you can start **shadow-cljs** and its nREPL server in two ways:
56
94
57
95
1. Using the **shadow-cljs** npm executable
58
96
2. Via the Clojure REPL in your Leiningen or **deps.edn** project
@@ -62,7 +100,7 @@ These options show up as **project types** when connecting or jacking in:
62
100
1. Project type: **shadow-cljs**
63
101
2. Project type: **deps.edn + shadow-cljs** or **Leiningen + shadow-cljs**
64
102
65
-
The technical difference here is wether you let **shadow-cljs** start **clojure**/**Leiningen** (the first option) or if you let Calva do it (the second option). If you let Calva do it, Calva will then start the **shadow-cljs** watcher from the Clojure process. From a usage perspective the two approaches will result in different channeling of **shadow-cljs** output, e.g. test runner results. With the first option (the **shadow-cljs** project type), **shadow-cljs** output will be channeled to the **Jack-in** terminal. With the **deps.edn**/**Leiningen** option, that output will be channeled to the Output/REPL window.
103
+
The technical difference here is whether you let **shadow-cljs** start **clojure**/**Leiningen** (the first option) or if you let Calva do it (the second option). If you let Calva do it, Calva will then start the **shadow-cljs** watcher from the Clojure process. From a usage perspective the two approaches will result in different channeling of **shadow-cljs** output, e.g. test runner results. With the first option (the **shadow-cljs** project type), **shadow-cljs** output will be channeled to the **Jack-in** terminal. With the **deps.edn**/**Leiningen** option, that output will be channeled to the Output/REPL window.
66
104
67
105
See [shadow-cljs + Clojure with Calva: The basics](https://blog.agical.se/en/posts/shadow-cljs-clojure-cljurescript-calva-nrepl-basics/) for some more discussion on how the REPL connection works.
0 commit comments