This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aleph (1)
- # announcements (2)
- # beginners (109)
- # calva (48)
- # cider (25)
- # clj-kondo (38)
- # cljdoc (13)
- # clojure (203)
- # clojure-europe (23)
- # clojure-gamedev (3)
- # clojure-nl (3)
- # clojure-uk (7)
- # conjure (2)
- # data-science (1)
- # datalog (2)
- # datomic (7)
- # deps-new (16)
- # depstar (2)
- # docker (2)
- # fulcro (67)
- # graalvm (58)
- # honeysql (16)
- # java (2)
- # jobs (2)
- # jobs-discuss (2)
- # kaocha (4)
- # lsp (82)
- # malli (23)
- # off-topic (35)
- # polylith (18)
- # practicalli (5)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (15)
- # sql (17)
- # timbre (1)
- # tools-deps (24)
- # vim (20)
- # xtdb (9)
Let's say that this
defn is only ever referenced by that namespace, thus I could choose to mark it as private, would it be possible to highlight that for me? LIke
1 reference, private only? If that function is used in another namespace, then it could show something like
1 reference external, 1 reference local
Not sure if I'm explaining myself clearly, I guess what I'm looking for is a way to easily see if functions could be made private quickly and easily.
yes, that's the idea, is just that custom lint is probably the heavier code of clojure-lsp which checks each var definition and count the references in the project
@U11EL3P9U You could also just write a custom linter for yourself using clj-kondo, while not seeing it in the editor but periodically writing out an HTML report for yourself to view
Sure, could do, would rather prefer if it was in the editor and done dynamicaly for me as I change the code about and jump from namespace to namespace.
I'm sure this is explained somewhere, but are those code lens things supposed to be interactive (in emacs)? The "N references" text looks clickable and the mouse cursor changes on hover, but nothing seems to occur.
LSP lens only allows trigger commands when clicking in a code lens, for example a code lens of
Debug should trigger a run or debug command for your app
references is something that needs a return, is not a command, so it's tricky, we just show it with a command that doesn't actually exists/works
It could be implemented on lsp-mode/vim etc to support that somehow, but it'd not follow the spec and it'd need to be done on each lsp client
it would be awfully nice if it could open something like
lsp-treemacs-call-hierarchy when clicked, for example
yeah, maybe we could hack only lsp-mode to advice that somehow, but it would need custom code just for clojure
if you figure out how to make it work in lsp-mode, i’ll make it work in coc-nvim
In vscode (JS/TS), clicking a lens shows references. Does that mean vscode doesn't follow the spec? Also, what sort of lsp-mode advice are you thinking @UKFSJSM38?
So, what sort of things make sense to get triggered on Lens click (LSP)? Perhaps we can wrap any of those actions with an advice?
The typescript lsp and server are tightly bound and have a lot of non standard functionality
Ah 😞 sounds like it'll be a big hack to utilize those for showing call heirarchy/references
The advice is something completely custom done in client, don't know it worth the work
Technically because of how the message protocol works, clojure-lsp could do the same but then we'd have to implement that behavior in each client
Yea, nvm. Actually I don't know why I'm invested in this 😛 I rarely use my mouse
I think custom methods are good for features specific for each lang/server like clojure which has a custom one to "resolve a macro as..." Which automatically change your clj-kondo config
Agreed. A non-standard feature I do want to get into clojure-lsp at some point is “import X from namespace Y” in the completion menu, but I need to do more research on how tsserver does it first to get an understanding of what that entails
oh? when typing an unknown var, the completion will say “import X from namespace Y” and then if you highlight it and press “enter” (or whatever), it completes the symbol while also adding it to the namespace declaration?
Weird, just tried it. Doesn't work anymore.
I remember (once or twice in the past):
• Executing code actions
• Selecting: import
@UKFSJSM38 Was this supported at one point?
Right, yea. I sometimes use emacs for TS/JS and the completion is via code action. In vscode it's part of completion, yea
The code action works, and we have support for add when completed as well, not sure if there is a bug
there are rules to require, for both completion or code action, clojure-lsp will be able to require a ns if:
• it's a known common alias, like
• the alias was already required before in a ns of the project, otherwise there is no way for clojure-lsp know.
your case is not an alias, is a refer, we could improve clojure-lsp to understand some common refers like
go-loop , actually, it already knows
we just need to be careful with what we add to completions without anything typed yet, because clojure-lsp already return 800+ items, if we'd add all public vars of all classpath that would probably blow up
Oh wow, interesting. Guess I don’t know how the completion works. I thought it was as you typed, not before
the completion can be triggered at any time, with something typed or even with nothing typed yet
FYI: I added clojure.async.core common macro/functions to suggested require code actions: https://github.com/clojure-lsp/clojure-lsp/commit/934e41cf7373d12d4fa8bf073cdcb78c44a33a55