Skip to content

Commit 4e5f8dd

Browse files
committed
wipper
1 parent db329b3 commit 4e5f8dd

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src-shared/nextjournal/clojure_mode/commands.cljc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
1 (some-> % n/with-prefix n/right n/end-edge?)
153153
-1 (some-> % n/with-prefix n/left n/start-edge?)))))]
154154
(let [str? (n/string? parent)]
155+
(prn :parent (n/string state parent) :str str?)
155156
(when-let [target (case direction 1 (first (remove n/line-comment? (n/rights (n/with-prefix parent))))
156157
-1 (first (remove n/line-comment? (n/lefts (n/with-prefix parent)))))]
157158
{:cursor/mapped from
@@ -163,12 +164,13 @@
163164
(-> edge
164165
n/from-to
165166
(cond->
166-
(not str?) (j/assoc! :insert " ")))])
167+
true #_(not str?) (j/assoc! :insert " ")))])
167168
-1
168169
(let [^string edge (n/left-edge-with-prefix state parent)
169170
start (n/start (n/with-prefix parent))]
170171
[(cond-> {:from start
171-
:to (+ start (count edge))}
172+
:to (+ start (count edge))
173+
#_#_:insert " "}
172174
(not str?) (j/assoc! :insert " "))
173175
{:from (n/start target)
174176
:insert edge}]))}))))))))

test/nextjournal/clojure_mode_tests.cljc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
[nextjournal.clojure-mode.commands :as commands]
99
[nextjournal.clojure-mode.extensions.formatting :as format]
1010
[nextjournal.clojure-mode.extensions.eval-region :as eval-region]
11+
[nextjournal.scratch]
1112
#?@(:squint []
1213
:cljs [[nextjournal.livedoc :as livedoc]])
1314
#?(:squint ["assert" :as assert]))
1415
#?(:squint (:require-macros [nextjournal.clojure-mode-tests.macros :refer [deftest are testing is]])))
1516

17+
#_(js/process.exit 0)
18+
1619
(def extensions
1720
(.concat cm-clojure/default-extensions (eval-region/extension #js {}))
1821
;; optionally test with live grammar

test/nextjournal/scratch.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns nextjournal.clojure-mode.scratch
1+
(ns nextjournal.scratch
22
(:require [nextjournal.clojure-mode.commands :as commands]
33
[nextjournal.clojure-mode :as cm-clojure]
44
[nextjournal.clojure-mode.extensions.eval-region :as eval-region]
@@ -9,6 +9,6 @@
99

1010
(def apply-f (partial test-utils/apply-f extensions))
1111

12-
(js/console.log "\"|\" 1")
13-
(js/console.log (apply-f (commands/slurp 1) "\"|\" 1"))
12+
(js/console.log "a ;; hello\n(|)")
13+
(js/console.log (apply-f (commands/slurp -1) "a ;; hello\n(|)"))
1414

0 commit comments

Comments
 (0)