Describe the bug
Dragging a file to a new folder triggers some refactoring which breaks auto-resolved keyword destructuring in function parameters.
To Reproduce
I'm doing this in VS Code with Calva. Steps to reproduce the behavior:
Create an empty project.
Add a bare-bones deps.edn file:
{:paths ["src"]}
Add a file at src/acme/ns1/test.clj:
(ns acme.ns1.test)
(defn my-fn [{::keys [payload]}]
(println "this is my-fn in the ns1 namespace"))
4. Create a second file at `src/acme/ns2/refer.clj`:
```clj
(ns acme.ns2.refer
(:require [acme.ns1.test :as test]))
(defn other-fn [{::test/keys [payload]}]
(println "This is the other fn"))
Drag test.clj file from the ns1 folder into same ns2 folder as refer.clj.
The test.clj file now looks like this (with some comments about what is right and what is not):
(ns acme.ns2.test)
;; ^^^^^^^^^^^^^ This change is correct.
(def foo "A string")
(defn my-fn [{::keys [:acme.ns2.test/payload]}]
;; ^^^^^^^^^^^^^^^ Strange, none of this should be here.
(println "this is my-fn in the ns1 namespace"))
7. Similarly, the `refer.clj` file now looks like this:
```clj
(ns acme.ns2.refer
(:require [acme.ns2.test :as test]))
;; ^^^^^^^^^^^^^ This change is correct.
(defn other-fn [{::test/keys [:acme.ns2.test/payload]}]
;; ^^^^^^^^^^^^^^^ This should not be here.
(println "This is the other fn"))
Expected behavior
See the final examples above in steps 6 and 7 for some comments about what changed incorrectly.
Thanks for the report, looks like a bug indeed, we will probably need to add a check when renaming the auto resolved keywords for when renaming the ns as well
Describe the bug Dragging a file to a new folder triggers some refactoring which breaks auto-resolved keyword destructuring in function parameters.
To Reproduce I'm doing this in VS Code with Calva. Steps to reproduce the behavior:
deps.edn
file:src/acme/ns1/test.clj
:(defn my-fn [{::keys [payload]}] (println "this is my-fn in the ns1 namespace"))
test.clj
file from the ns1 folder into same ns2 folder asrefer.clj
.test.clj
file now looks like this (with some comments about what is right and what is not):(def foo "A string")
(defn my-fn [{::keys [:acme.ns2.test/payload]}] ;; ^^^^^^^^^^^^^^^ Strange, none of this should be here. (println "this is my-fn in the ns1 namespace"))
Expected behavior See the final examples above in steps 6 and 7 for some comments about what changed incorrectly.
Log - client <-> server
User details (please complete the following information):
Additional context This happened in a large project I was working on. What I created above was just a simple example to illustrate the problem.