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

Add keyword definitions (reg-...) to :clojure/workspace/projectTree/nodes

zikajk opened this issue · comments

Is your feature request related to a problem? Please describe.
I can get all fns and vars for a namespace by :clojure/workspace/projectTree/nodes which is used to build a project-tree.
I built a project-tree for Eglot and I would like to extend CLJS namespace node by 'keyword definitions' of re-frame subscriptions or events like:

(rf/reg-sub
 ::spinner-count ...)

(reg-event-db
 ::set ...)

Clojure-lsp already supports find definition / references on them. It would be useful to see them in project-tree as well.

Describe the solution you'd like
Having them inside a response from :clojure/workspace/projectTree/nodes as an another type would be useful when building a tree.

Alternative solutions you'd like

  • new type of request that will return all reg-... for a node (namespace).
    • maybe the request can be customized by clj-kondo configuration so it is not limited to reg-... only

@zikajk sounds good, we just need to define well if we will have a new type and change all doc places as well, it should not be hard to support that, LMK if you wanna work on that

Do you think it is a good idea to have re-frames as part of project-nodes permanently, or would it be possible to define clj-custom hooks to be used?

@zikajk the idea is to consider keyword definition which should include anything from custom hooks that is tagged as keyword definition, including re-frame macros

@ericdallo If the user will be able to configure what he wants to analyze within the new type, that sounds good. I would work on it, but where to start?

@zikajk it was pretty simple to add ;)
image

That is great. So it will be a new, 10th type called function?

I used the same function type to avoid the need to change all clients to support a new one, and I think it's enough given the detail mentioning the keyword reg definition