Skip to content

Commit

Permalink
Merge branch 'frankitox-fix-vary-meta-issue'
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed May 9, 2024
2 parents a5bbba2 + 5cf74b8 commit d1d3a54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/kibit/replace.clj
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@
(-> zipper rewrite.zip/node meta :row)))
(recur (rewrite.zip/edit zipper
(fn -replace-zipper [sexpr]
(vary-meta (:alt check-map)
(fn -remove-loc [m]
(dissoc m
:line
:column)))))
(let [alt (:alt check-map)]
(if (meta alt)
(vary-meta alt
(fn -remove-loc [m]
(dissoc m
:line
:column)))
alt))))
reporter
kw-opts)
zipper)
Expand Down
6 changes: 6 additions & 0 deletions test/kibit/test/replace.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
'(inc a)
'(+ 1 a)

'1
'(do 1)

'(defn "Documentation" ^{:my-meta 1} [a]
;; a comment
(inc a))
Expand All @@ -38,6 +41,9 @@
"(inc a)"
"(+ 1 a)"

"1"
"(do 1)"

"(ns replace-file)
(defn \"Documentation\" ^{:my-meta 1} [a]
Expand Down

0 comments on commit d1d3a54

Please sign in to comment.