Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename namespace alias with API / CLI #1792

Open
witek opened this issue Mar 15, 2024 · 3 comments
Open

Rename namespace alias with API / CLI #1792

witek opened this issue Mar 15, 2024 · 3 comments
Labels
API Related to API / CLI enhancement New feature or request good first issue Good for newcomers
Projects

Comments

@witek
Copy link

witek commented Mar 15, 2024

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.

@witek witek added the enhancement New feature or request label Mar 15, 2024
@ericdallo
Copy link
Member

Would be nice if we could use the same existing rename! function supporting the alias

@witek
Copy link
Author

witek commented Mar 19, 2024

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.

@ericdallo
Copy link
Member

yeah, would complicate a little bit the internal api, but I agree it's easier, I think a separated one is a good way.

@ericdallo ericdallo added this to Low priority in clojure-lsp via automation Mar 23, 2024
@ericdallo ericdallo added good first issue Good for newcomers API Related to API / CLI labels Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to API / CLI enhancement New feature or request good first issue Good for newcomers
Projects
clojure-lsp
Low priority
Development

No branches or pull requests

2 participants