This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-21
Channels
- # announcements (2)
- # asami (8)
- # aws (4)
- # beginners (32)
- # calva (12)
- # cider (72)
- # clj-kondo (16)
- # clojure (11)
- # clojure-germany (2)
- # clojure-italy (4)
- # clojure-serbia (2)
- # clojurescript (26)
- # data-oriented-programming (8)
- # datomic (9)
- # deps-new (17)
- # eastwood (4)
- # emacs (20)
- # fulcro (18)
- # funcool (1)
- # graalvm (8)
- # leiningen (12)
- # lsp (34)
- # malli (25)
- # meander (4)
- # membrane (4)
- # off-topic (153)
- # practicalli (1)
- # releases (2)
- # remote-jobs (3)
- # rewrite-clj (77)
- # ring (5)
- # shadow-cljs (108)
- # spacemacs (12)
- # tools-deps (9)
- # vscode (11)
- # xtdb (4)
Thanks, from the change log? Seems to work for me, but I’ll check for any broken links tomorrow.
Directly from the cljdoc site: https://cljdoc.org/d/rewrite-clj/rewrite-clj/1.0.594-alpha/doc/design/merging-rewrite-clj-and-rewrite-cljs
Hey, I appreciate you sharing your confusion, I’m sure you won’t be the only one. Maybe I’ll go fix that missing doc title bug over at cljdoc,
It could look a dumb question, but, how can I create a zipper from a empty map?
I can create with: (z/of-string "{:foo 1}")
that return a :map
tag correctly, but no with (z/of-string "{}")
Oh, (z/tag (z/of-string "{}"))
it's returning :map now, for some reason I thought seeing returning unknown as well :thinking_face:
Another way to create an empty map node:
user=> (require '[rewrite-clj.node :as n])
nil
user=> (-> (n/map-node []) n/string)
"{}"
But I can't convert that to zip, right?
My case is that I need to create a empty {}
and assoc things with rewrite-clj later
when you see :unkown
for tag
you are looking at something that is not a rewrite-clj node:
user=> (n/tag 32)
:unknown
Maybe this’ll help: https://cljdoc.org/d/rewrite-clj/rewrite-clj/1.0.594-alpha/doc/user-guide#_creating_nodes
Thank you! For now rewrite-clj is just working great! I'm heavily relying to update clj-kondo config from clojure-lsp side
@UKFSJSM38 if you need to update the :lint-as
map in config.edn
you can also use r/assoc-in
from https://github.com/borkdude/rewrite-edn :)
Oh my, I just know the assoc one, thank you @U04V15CAJ Is should tried that one
I can't find those on docs though https://cljdoc.org/d/rewrite-clj/rewrite-clj/1.0.594-alpha/api/rewrite-clj.zip
https://github.com/borkdude/rewrite-edn rewrite-edn, not rewrite-clj
@U04V15CAJ Is that suppose to work?
(-> (z/of-string "{:foo {bar asd}}")
(r/assoc-in [:foo 'bar] 'asd))
Is this supposed to work?
(-> (z/of-string "{:a 1}")
z/node
(r/assoc-in [:lint-as 'foo] 'bar))
it gives a No implementation of method: :tag of protocol: #'rewrite-clj.node.protocols/Node found for class: nil
but this works:
(-> (z/of-string "{}")
z/node
(r/assoc-in [:lint-as 'foo] 'bar))
this test gives the same exception:
(is (= "{:a {:b 2} :d 3}"
(str (r/assoc-in (r/parse-string "{:d 3}")
[:a :b] 2))))
the issue seems to be this nil arg: https://github.com/borkdude/rewrite-edn/blob/master/src/borkdude/rewrite_edn/impl.cljc#L101
the same happens with update-in
, so it seems to be a bug indeed as assoc-in use update-in
confirmed. user=> (r/assoc-in (r/parse-string "{:a 1}") [:b :c] 1) Execution error (IllegalArgumentException) at rewrite-clj.node.protocols/eval230$fn$G (protocols.cljc:9). No implementation of method: :tag of protocol: #'rewrite-clj.node.protocols/Node found for class: nil
this namespaced prefix stuff in clojure has made tooling more complex, not sure if it was worth it
https://github.com/borkdude/rewrite-edn/commit/453bafe5d3233fe173eed637162f1c3c1ce5b06a#r48516020