Skip to content

Commit e47c660

Browse files
committed
Add :echo-editor-code to show only output from editor evaluations
1 parent 0eecde8 commit e47c660

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Changelog
22
===========
33

4+
* 0.2.1 on Oct 19, 2026
5+
* Add `:echo-editor-code` to show only output from editor evaluations
46
* 0.2.0 on Oct 19, 2026
57
* Show evaluations sent from an editor in the terminal REPL
68
* TAB completion using the nREPL completions op

‎client/src/clojure_cli/repl/client.clj‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@
398398
(.setPrompt rdr (render-prompt prompt-fn))
399399
(.redisplay rdr))
400400

401-
(defn show-reply [evals {:keys [eval-id code out err value status] :as reply} rdr prompt-fn libspecs follow-ns?]
402-
(when code (print-echo reply prompt-fn))
401+
(defn show-reply [evals {:keys [eval-id code out err value status] :as reply} rdr prompt-fn libspecs follow-ns? echo-code?]
402+
(when (and code echo-code?) (print-echo reply prompt-fn))
403403
(when-let [text (or out err value)] (api/print-above [{:text (str/trim-newline text)}]))
404404
(let [merged (merge (get evals eval-id) reply)]
405405
(if (some #{"eval-done"} status)
@@ -411,10 +411,10 @@
411411
"Runs on its own thread since the main thread is waiting for input.
412412
Continues to run until the connection is closed.
413413
Replies are collected until each eval is done."
414-
[port session-id rdr prompt-fn libspecs follow-ns?]
414+
[port session-id rdr prompt-fn libspecs follow-ns? echo-code?]
415415
(future
416416
(reduce (fn [evals reply]
417-
(try (show-reply evals reply rdr prompt-fn libspecs follow-ns?)
417+
(try (show-reply evals reply rdr prompt-fn libspecs follow-ns? echo-code?)
418418
(catch Throwable e
419419
(api/print-above [{:text (str "clojure-cli.repl: watch: " (ex-message e))}])
420420
evals)))
@@ -444,7 +444,7 @@
444444
(handle [_ _sig]
445445
(nrepl/interrupt session))))
446446
(println "connected to nREPL on" port)
447-
(watch-evals port session-id rdr prompt-fn libspecs (:follow-editor-ns config))
447+
(watch-evals port session-id rdr prompt-fn libspecs (:follow-editor-ns config) (:echo-editor-code config true))
448448
(auto-require @api/current-ns libspecs)
449449
(loop []
450450
(let [line (try (.readLine rdr (render-prompt prompt-fn))

‎doc/configuration.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The scope column names the process a key configures. Either the JLine client or
4545
| `:paredit/<op>` | client | [key string](#key-strings) | Bind a [structural editing op](editing.md). Example: `:paredit/raise "C-x r"`. | none |
4646
| `:auto-require` | client | vector of libspecs | [Required into each namespace](#auto-require). | none |
4747
| `:follow-editor-ns` | client | boolean | Enter the namespace of each eval [sent from an editor](editors.md). | `false` |
48+
| `:echo-editor-code` | client | boolean | Show the code of each eval [sent from an editor](editors.md) above its output. | `true` |
4849
| `:middleware` | server | vector of [qualified symbols](#user-code) | [Server data on eval responses](middleware.md). | none |
4950
| `:eval-hook` | server | [qualified symbol](#user-code) | [Wraps eval](hooks.md). | none |
5051
| `:print-hook` | server | [qualified symbol](#user-code) | [Wraps result printing](hooks.md). | none |

‎doc/editors.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ file that it writes.
2828
When an editor starts the server, run `clojure -M:attach` to launch the terminal
2929
REPL, by hand or scripted from your editor.
3030

31+
## Code echo
32+
33+
Set `:echo-editor-code` to `false` to show only the output of each editor evaluation.
34+
35+
```clojure
36+
;; .cljconf/org.clojure/clojure-cli.repl.edn
37+
{:echo-editor-code false}
38+
```
39+
3140
## Namespace
3241

3342
Each editor evaluation runs in the namespace of the file that the code comes

0 commit comments

Comments
 (0)