Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide cider function to find all known impls of a protocol function #204

Open
kapilreddy opened this issue Nov 18, 2018 · 4 comments
Open
Labels

Comments

@kapilreddy
Copy link

The feature-request has been posted on "cider"

clojure-emacs/cider#1969

Creating an issue here to send a pull request and start a discussion about the solution.

@bbatsov bbatsov added enhancement Improvement to an existing feature good first issue Good for newcomers labels May 6, 2019
@vemv vemv transferred this issue from clojure-emacs/cider-nrepl Oct 29, 2023
@vemv
Copy link
Member

vemv commented Oct 29, 2023

(Moved from cider-nrepl)

@vemv vemv added xref and removed enhancement Improvement to an existing feature good first issue Good for newcomers labels Oct 29, 2023
@harold
Copy link

harold commented Oct 24, 2024

Related discussion on Clojurians slack: https://clojurians.slack.com/archives/C0617A8PQ/p1729784739018019


Super interesting, thank you @vemv for the pointer here.

Do people have strong feelings on implementing this with/without kondo? Is it possible to do it without kondo?

@vemv
Copy link
Member

vemv commented Oct 25, 2024

I think that using clj-kondo would be a quite natural thing (to be done in cider-nrepl though - not Orchard). cider-nrepl already uses a variety of libs.

It would be a large undertaking though with many possible ramifications and implications.

So my thinking is that we could also read .clj-kondo / clojure-lsp directories on the fly, no lib involved, using some heuristics to determine if the contents are fresh, and finally, double-checking if the results makes sense (i.e. do they look like protocol impls).

(This thinking comes from the observation that many users of commercial codebases regularly run kondo / lsp locally in some or other way, or have a means to trigger a CI-oriented script)

It's also possible to roll our own static codebase parsing, although I wouldn't underestimate its complexity (and proneness to false positives / negatives). I'd reserve the technique for simpler use cases, as I outlined in another issue #181

Cheers - V

@harold
Copy link

harold commented Oct 29, 2024

Relevant bit of clj-kondo analysis config:

https://github.com/clj-kondo/clj-kondo/tree/master/analysis#extra-analysis

Need to include :analysis {:protocol-impls true} in clj-kondo config to get it to locate individual protocol method implementations.

c.f., this issue as well (with some additional hints in it):

clj-kondo/clj-kondo#405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants