Skip to content

Commit d914bed

Browse files
committed
Fix #54: slurping within string doesn't work
1 parent 6436843 commit d914bed

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

Diff for: src-shared/nextjournal/clojure_mode/commands.cljc

+3-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136

137137
(def log js/console.log)
138138

139+
(defn ->str [x]
140+
(js/JSON.stringify (str x)))
141+
139142
(defn slurp [direction]
140143
(fn [^js state]
141144
(u/update-ranges state
@@ -151,7 +154,6 @@
151154
(let [str? (n/string? parent)]
152155
(when-let [target (case direction 1 (first (remove n/line-comment? (n/rights (n/with-prefix parent))))
153156
-1 (first (remove n/line-comment? (n/lefts (n/with-prefix parent)))))]
154-
(js/console.log :target target)
155157
{:cursor/mapped from
156158
:changes (case direction
157159
1

Diff for: src-shared/nextjournal/clojure_mode/scratch.cljs

-12
This file was deleted.

Diff for: test/nextjournal/clojure_mode_tests.cljc

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
"(<a) b>" "<(a) b>"
250250
))
251251

252-
(deftest slurp
252+
(deftest slurp-test
253253
(are [input dir expected]
254254
(= (apply-f (commands/slurp dir) input) expected)
255255
"(|) a" 1 "(|a)"
@@ -273,7 +273,7 @@
273273
"('xy|z 1) 2" 1 "('xy|z 1 2)"
274274
"'ab|c 1" 1 "'ab|c 1"
275275

276-
"\"x|\" 1" 1 "\"x1\""))
276+
"\"x|\" 1" 1 "\"x| 1\""))
277277

278278
#?(:squint nil
279279
:cljs

0 commit comments

Comments
 (0)