-
-
Notifications
You must be signed in to change notification settings - Fork 647
[feature request] add feature to find cross references for a function or var #1840
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
Comments
I think clj-refactor's |
@grammati Thanks. |
Actually the SLIME feature finds actual calls to the function at point rather than just textual occurrences. If I'm reading the clj-refactor feature correctly, it's the later not the former. Waaay back when cider was still hacked-SLIME, it did have this feature. I wish we had it still too. :) |
@timvisher glad to hear this. I will re-open this feature request. |
I want us to have something similar at CIDER itself eventually.
This was just a textual search, which is rather easy to add back. Doing something different that's not relying on an AST is a bit harder, but is definitely possible. |
@bbatsov Are you sure it was just a textual search? Did it at least try to filter for things that looked like calls? My memory (which is foggy) was that it really did search for references to the var or something. |
This is the old implementation - https://github.com/technomancy/swank-clojure/blob/master/src/swank/commands/xref.clj Everyone's welcome to port it to an nREPL middleware. |
Will take a look at it |
@sanjayl Awesome! Let me know if I can help with anything.
|
Thanks ! On Sun, Sep 4, 2016 at 6:52 AM, Chaitanya Koparkar <[email protected]
John Boyd |
@sanjayl Thanks for tackling this! |
@sanjayl any news on this? |
Sorry, hit a wall and ran out of steam. I have the next few days off so I'll see what I can do on the clojure side of things, doubt I'll have time to work on the UI half. |
One step at a time. I believe you'll be able to pretty much copy/paste the UI from SLIME or just leverage the new xref functionality from recent Emacsen. |
@bbatsov Is this still an issue? From what I can see |
@bkruczyk That's certainly not the case. Such functionality doesn't really belong in nREPL itself and will never be part of nREPL I guess. The only nREPL middleware that provides something like this is |
@bkruczyk it has to evaluate all the code to understand it. |
@bkruczyk swank also need to load all common lisp code in slime repl before cross reference. But that's not a problem for cl, because there's a different workflow between cl and clj. CL programmers have habit to load all project files from slime-repl using |
If so, then is it possible to provide two solution. use textual search by default. (As @ailisp upper said) |
@ailisp We already have functionality to load the entire project if necessary, so that's not a big deal. I don't think swank-clojure was doing this for Clojure, and people were kind of OK with the feature, though, so I don't think that's a big deal. @stardiviner The textual search is pretty much the same approach. It's not really related to loading everything or not. It's just a way to try to find call site for some functions. |
@stardiviner That's really a good idea. I prefer to use a same key binding to do semantic search first and if nothing found fall over to text search though. But this is trivial to do in init file after implement both options. |
1+ for having this! Geiser implements this but I do believe it relies on the underlying Scheme for doing it accurately. |
Just discovered this today, and it's great! Thanks @bbatsov 🙇 |
I hope CIDER can add a feature to find all cross references for a function or var.
For examples, list out all places which used a function or var.
Common Lisp's SLIME has this function called
slime-who-references
. And Emacs Lisp has this function calledxref-find-references
[M-?]
.The text was updated successfully, but these errors were encountered: