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
Clojure Sublimed just updated to 3.0.0! It’s a huge rewrite with many exciting features:
2
+
3
+
- REPL doesn’t depend on syntax highlighting anymore.
4
+
- On top of JVM nREPL and ShadowCLJS nREPL, we now support Raw nREPL (no extra middlewares, so less quality, but should work anywhere) and JVM Socket REPL (works on core Clojure with 0 dependencies).
5
+
- It is now much easier to add new REPLs. Contributions welcome :)
6
+
- Pretty-printer now works client-side, same on every REPL.
7
+
- Indenter and formatter work much faster now and do not require setting `Clojure (Sublimed)` syntax.
8
+
9
+
Let me know if anything breaks. If you were using JVM nREPL, I recommend switching to Socket REPL as it has better support in Clojure Sublimed, faster startup and brighter future.
@@ -22,19 +26,22 @@ Clojure Sublimed ships with its own syntax definition for Clojure and EDN. Unlik
22
26
- semantically correct tokenization, perfect for fonts with ligatures,
23
27
- has separate EDN syntax, same way JSON is separate from JavaScript in Sublime Text.
24
28
25
-
Want to put your parser to test? Check out [syntax_test_edn.edn](./test_syntax/syntax_test_edn.edn) and [syntax_test_clojure.cljc](./test_syntax/syntax_test_clojure.cljc).
29
+
How to enable? Assign syntax to Clojure files:
26
30
27
-
Clojure Sublimed syntax is also used by nREPL client to find form boundaries and namespaces (might be changed in the future).
31
+
- open any clj/cljc/cljs file,
32
+
- run `View` → `Syntax` → `Open all with current extension as...` → `Clojure Sublimed` → `Clojure (Sublimed)`.
33
+
34
+
Want to put your parser to test? Check out [syntax_test_edn.edn](./test_syntax/syntax_test_edn.edn) and [syntax_test_clojure.cljc](./test_syntax/syntax_test_clojure.cljc).
28
35
29
36
## Formatter/indenter
30
37
31
-
Clojure Sublimed includes optional support for [Simple Clojure Formatting rules](https://tonsky.me/blog/clojurefmt/). It doesn’t require nREPL connection but does require `Clojure (Sublimed)` syntax to be selected for buffer.
38
+
Clojure Sublimed includes optional support for [Simple Clojure Formatting rules](https://tonsky.me/blog/clojurefmt/). It doesn’t require REPL connection, any Clojure runtime or external tools.
32
39
33
40
To reformat whole file, run `Clojure Sublimed: Reindent Buffer`.
34
41
35
-
To reindent only current line(s), run `Clojure Sublimed: Reindent Lines`.
42
+
To reindent only selected line(s), run `Clojure Sublimed: Reindent Lines`.
36
43
37
-
To enable reindenting / formatting on save, add `format_on_save: true` to settings. ([See how to edit settings](#editing-settings))
44
+
To enable reindenting/formatting on save, add `format_on_save: true` to settings. ([See how to edit settings](#editing-settings))
38
45
39
46
To enable correct indentations as you type code, rebind `Enter` to `Clojure Sublimed: Insert Newline`:
40
47
@@ -48,15 +55,14 @@ To enable correct indentations as you type code, rebind `Enter` to `Clojure Subl
48
55
49
56
Best way to do it is through running `Preferences: Clojure Sublimed Key Bindings`.
50
57
51
-
## nREPL Client
58
+
## REPL clients
52
59
53
-
Clojure Sublimed nREPL client enables interactive development from the comfort of your editor.
60
+
Clojure Sublimed REPL clients enable interactive development from the comfort of your editor.
- Server-agnostic. We work with any nREPL socket, local or over network.
60
66
61
67
Features:
62
68
@@ -69,23 +75,30 @@ Features:
69
75
-[x] show evaluation time,
70
76
-[x] bind keys to eval arbitrary code.
71
77
78
+
Clojure Sublimed has four REPL clients:
79
+
80
+
1. Raw nREPL: no extra middlewares, could work with any nREPL server.
81
+
2. JVM nREPL: only works with JVM server.
82
+
3. ShadowCLJS nREPL: works with ShadowCLJS
83
+
4. JVM Socket REPL: works with raw Socket REPL on JVM
84
+
85
+
All four support same basic features (eval, lookup, interrupt on JVM), maybe with slightly different quality of implementation.
86
+
87
+
How to choose which REPL to use?
88
+
89
+
1. Are you on JVM? Use Socket REPL.
90
+
2. CLJS? Use ShadowCLJS REPL.
91
+
3. Only have basic nREPL? Use Raw nREPL.
92
+
4. JVM nREPL is mostly a carryover from Clojure Sublime v1-2 and is now superseded by Socket REPL. Works better than Raw nREPL but worse than Socket REPL.
93
+
72
94
We intentionally excluded following features:
73
95
74
96
-[ ] Autocomplete. Static analysis is much simpler and much more reliable than requiring an always-live connection to the working app.
75
97
76
98
Look at [Sublime LSP](https://github.com/sublimelsp/LSP) with [Clojure LSP](https://github.com/clojure-lsp/clojure-lsp) or [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) with [clj-kondo](https://github.com/ToxicFrog/SublimeLinter-contrib-clj-kondo) if you need autocompletion.
77
99
78
-
Why nREPL and not Socket Server REPL/pREPL/unREPL?
79
-
80
-
- nREPL has the widest adoption,
81
-
- nREPL is machine-friendly,
82
-
- nREPL comes with batteries included (interrupt, load-file, sideload),
83
-
- nREPL is extensible via middleware,
84
-
- nREPL serialization is easier to access from Python than EDN.
85
-
86
100
Differences from [Tutkain](https://tutkain.flowthing.me/):
87
101
88
-
- nREPL instead of Socket Server REPL
89
102
- Does not have separate REPL panel
90
103
- Keeps multiple eval results on a screen simultaneously
91
104
- Can show stack traces inline in editor
@@ -94,30 +107,23 @@ Differences from [Tutkain](https://tutkain.flowthing.me/):
94
107
- Can eval infinite sequences
95
108
- Redirects all `*out*`/`*err*` to `System.out`/`System.err`
To set it up, run `Preferences: Clojure Sublimed Key Bindings` command and copy example keybindings to your local Key Bindings file.
228
236
237
+
## stdout/stderr
238
+
239
+
Clojure Sublimed does things a little different when it comes to stdout. Normally REPL would show you all stdout/stderr that originated from your session. I find it confusing, because it doesn’t always work and you have to check two places for output. Moreover, there’s no output panel, so there’s no place to show stdout anyway.
240
+
241
+
So instead, Clojure Sublimed _does not_ redirect neither stdout nor stderr. Check original console to see what was printed there.
0 commit comments