clojure-lsp/clojure-lsp

Rename namespace alias with API / CLI

Open

#1,792 opened on Mar 15, 2024

View on GitHub
 (3 comments) (2 reactions) (0 assignees)Clojure (177 forks)batch import
APIenhancementgood first issue

Repository metrics

Stars
 (1,310 stars)
PR merge metrics
 (Avg merge 47d 8h) (24 merged PRs in 30d)

Description

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.

Contributor guide