This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-20
Channels
- # announcements (1)
- # babashka (4)
- # beginners (8)
- # cider (4)
- # clj-kondo (10)
- # cljdoc (1)
- # cljsrn (7)
- # clojure (3)
- # clojure-europe (20)
- # clojure-france (3)
- # clojure-sg (2)
- # clojurescript (16)
- # clojureverse-ops (3)
- # community-development (5)
- # core-async (35)
- # cursive (1)
- # datahike (14)
- # datomic (7)
- # events (5)
- # fulcro (59)
- # graphql (11)
- # lsp (33)
- # meander (1)
- # off-topic (33)
- # polylith (23)
- # portal (33)
- # re-frame (1)
- # reagent (10)
- # reclojure (7)
- # reveal (14)
My colleague @holyjak was looking for some specific calls to a fn based on arity, so he ended up with:
clj -Sdeps {io.github.borkdude/grasp {:git/sha "435301926d9e832964a75bf117e4199651d21a53"}} (g/grasp "/path/to/ardoq" (g/seq (g/rsym 'ardoq.core/->context) any? any? any?))
I have no idea how to implement in a UI, but I think it would be useful as a feature in general, it’s like a “find references”, but on steroids.It's a find references but that matches the function arity? If doesn't matches it'd throw an error right? Not sure the use case here
The use case was that I wanted to remove the 3 årg version of the fn so wanted to find where that is used
you can find this using the clj-kondo static analysis output as well.
:var-usages, a list of maps with:
:filename
:name: the name of the used var
:row, col: the start position of this usage, the parenthesis start location if a function call
:end-row, end-col: the end position of this usage, the parenthesis end location if a function call
:name-row, :name-col: the start position of the name of this usage
:name-end-row, :name-end-col: the end position of the name of this usage
:from: the namespace from which the var was used
:to: the namespace of the used var
:from-var: the function name from which the var was used
Optional:
:arity: if the usage was a function call, the amount of arguments passed
IMO that could work on clojure-lsp, passing some extra info to filter N arities, needs to check if we could hack the spec for that though
This seems like a rather one-off analysis thing for which I would just write a script rather than hacking it into lsp
yeah, actually you already have clj-kondo analysis for your whole project since clojure-lsp uses it, maybe we could have a custom method to expose that to user
@UKFSJSM38 I think it would be better to allow users to query directly on the datalevin database using datalog ;)
but this would require you to expose the structure of the database, not sure you want to do that
yeah, it's something that could open doors for a lot of possibilities indeed, I don't see any issues exposing db structure I think, needs some hammock time though I think
Just to be clear, I'm perfectly happy with this not being a part of clojure-lsp, and I really appreciate the hammock time
I think I want to experiment throwing the clj-kondo analysis into #asami because it also keeps track of history
@U04V5VAUN @holyjak example: https://gist.github.com/borkdude/e3059d88c907e1523fd11009cc09679c#file-konsami-clj-L38-L54
this can also be done from a babashka script even with datalevin + clj-kondo as a pod.
Is the var name always unqualified or..?
Thank you!
In theory allowing you to do stuff like only running the test for code that changed etc
I think you could build that on this analysis by looking at the transitive namespace graph and file modified times for example
Is anyone able to follow these instructions successfully to get a debugger in cljs? https://emacs-lsp.github.io/lsp-mode/tutorials/debugging-clojure-script/ I can't figure out how to install this google chrome debug adapter. i don't have a M-X dap-chrome-setup command and the link takes me to a deprecated extension.