rename ns picks wrong source-path
opqdonut opened this issue · comments
Describe the bug
Performing a rename of namespace foo.bar
(living in src/cljs/foo/bar.clj
) to foo.quux
results in file src/clj/foo/quux.clj
. The source-path changes from src/cljs
to src/clj
.
To Reproduce
M-x lsp-rename
foo.bar
tofoo.quux
Expected behavior
I expect the renamed ns to stay within the same source-path.
User details (please complete the following information):
- OS: MacOs
- Editor: Emacs
- Version: 2024.03.31-19.15.11-nightly
Additional context
We think the bug is in filename->source-paths
. It uses string/starts-with?
which gives a false positive on src/clj
because src/cljs/...
indeed starts with src/clj
!
clojure-lsp/lib/src/clojure_lsp/shared.clj
Line 254 in a922507
To test this theory we changed the project config to have src/aljs
and src/clj
. After that the rename uses the right source-path.
We're willing to make a PR.