clojure-lsp / clojure-lsp

Clojure & ClojureScript Language Server (LSP) implementation

Home Page:https://clojure-lsp.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support correct namespace for exported clj-kondo hooks

mrkam2 opened this issue · comments

Is your feature request related to a problem? Please describe.
When I create a clj-kondo hook file in resources/clj-kondo.exports/<org_name>/<lib_name>/…/<ns_name>.clj, it gets a (ns clj-kondo.exports.<org_name>.<lib_name>...) declaration which I need to fix to remove clj-kondo.exports.<org_name>.<lib_name>. prefix from it.

Describe the solution you'd like
It would be great for clojure-lsp to recognize this situation and create correct namespace declaration.

Here is a detailed example. Let's say I'm working in a library my-company/cool-lib and create a hook for a macro that lives in namespace feature.helper. I will create a hook file in resources/clj-kondo.exports/my-company/cool-lib/hooks/feature/helper.clj and I need its namespace declaration to be (ns hooks.feature.helper).

References:

  1. https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting
  2. https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#clojure-code-as-rewrite-clj-nodes