clojure-lsp
clojure-lsp copied to clipboard
Rename namespace alias with API / CLI
Is your feature request related to a problem? Please describe.
In the Editor integration I can point to a namespace alias and then rename it. But this feature is not exposed to the public API.
Describe the solution you'd like
Option A:
(clojure-lsp.api/rename-ns-alias!
{:target-namespace 'clojure.string
:alias 'str })
Running this on the project, would unify the alias to clojure.string
in all files.
Option B:
(clojure-lsp.api/rename-ns-alias!
{:from 'clojure-string
:to 'str})
This would only match an existing alias clojure-string
and rename it, independent of the target namespace it points to.
Would be nice if we could use the same existing rename! function supporting the alias
Would be nice if we could use the same existing rename! function supporting the alias
Du you have a specific reason for this? The current rename!
function expects symbols in :from
and :to
, while renaming an alias needs different types of arguments. Also there could be an alias with the same name as a var in a namespace. Then it would be not clear, which one is targeted.
My first guess is, that two simpler functions are easier to understand then one which complicates the two things.
yeah, would complicate a little bit the internal api, but I agree it's easier, I think a separated one is a good way.