This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-11
Channels
- # aleph (7)
- # announcements (5)
- # beginners (58)
- # calva (20)
- # cider (10)
- # clj-kondo (4)
- # cljfx (5)
- # cljsrn (7)
- # clojure (29)
- # clojure-europe (11)
- # clojure-mexico (1)
- # clojure-norway (26)
- # clojure-uk (9)
- # clojurescript (1)
- # cursive (31)
- # datahike (22)
- # datomic (12)
- # duct (3)
- # fulcro (28)
- # helix (35)
- # hyperfiddle (28)
- # lsp (4)
- # malli (8)
- # midje (3)
- # music (2)
- # nbb (9)
- # nrepl (20)
- # off-topic (36)
- # polylith (3)
- # shadow-cljs (47)
- # sql (2)
- # testing (7)
- # vim (17)
- # xtdb (7)
I'm getting unexpected behaviour renaming keywords:
(let [{:foo/keys [bar]} {:fo|o/bar 1}]
bar)
produces:
(let [{:foo/keys [baz]} {:foo/baz 1}]
bar)
where I expect the bar
inside the let body to also be renamed to baz
to keep things consistent.
:server-version "2022.07.24-18.25.43",
:clj-kondo-version "2022.06.23-SNAPSHOT",
I think maybe I'm hitting https://github.com/clojure-lsp/clojure-lsp/issues/978.When clj-kondo parses {:foo/keys [bar]
, it emits two https://github.com/clj-kondo/clj-kondo/tree/master/analysis elements for bar
, a “keyword” and a “local”. That is, that bar
is both a keyword usage and a local definition. When you invoke rename from another keyword, clojure-lsp finds all the matching keywords and renames them. That’s why {:foo/keys [bar]}
becomes {:foo/keys [baz]}
. But you’re right, since bar
is also a local definition, it would make sense to rename the local usages too. Would you open an issue in github for this?
Thanks for the explanation, @U07M2C8TT. Sure, I'd be happy to create an issue to track this. I will have it up sometime later today and will leave drop the link here for reference.