-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
cider-find-var: jump to namespace-qualified keywords #2112
Comments
Hi, I wanted this too, specifically for re-frame registrations. My solution (which is re-frame specific) is here: https://github.com/oliyh/re-jump.el It lets you jump from |
Nice! I took a look - is it actually re-frame specific? The code looks clean although there might be an implicit assumption I fail to see. |
Hi @vemv, The one assumption is on this line: https://github.com/oliyh/re-jump.el/blob/master/re-jump.el#L22 It's looking for something that starts with "reg-" which is the pattern that re-frame uses. I found I needed this because the first instance in a file wouldn't necessarily be the registration, but that's the only bit you need to change if you want a much more generic case. |
I guessing this can be done relatively easy:
|
I see @oliyh did something along those lines but for some reason decided not to use |
Thanks for the tip @bbatsov :) The problem with the first mention is that it may still be a usage rather than a declaration. re-jump searches for the registration. I could do the same for (def ::xyz) if the search for reg failed and then it should handle this use case too. |
Of you can do it configurable in the spirit of Emacs and people would be able to just set different values for different projects. :-) Anyways, feel free to submit this to CIDER if you want. |
My solution for such case is to add custom regexp to imenu and then use imenu-anywhere to jump around. Specifically, for re-frame it's: (add-to-list 'imenu-generic-expression
'("re-frame" "(register-\\(handler\\|sub\\)[ \n]+\\([^\t \n]+\\)" 2)
t) |
That's a very cool idea! |
Tried out! Unfortunately the functionality won't work for me: it will print The culprit seems to be this call: If you see its implementation:
You'll see that it does a somewhat dubious So the root cause (at least in my case) is that Using clojurescript. CIDER works great for me (no setup issues) so IDK why |
I just checked, and this functionality and |
Maybe something is broken with the ns caching on ClojureScript. Run this with the Elisp debugger and see what's going on exactly there. |
Hi there!
I have a feature request, hopefully a reasonable one.
When using
cider-find-var
over a ns-qualified keyword such as e.g.::other.namespace/foo
, CIDER won't jump to anything.This is partly justified, as keywords are literal values, and as such don't belong anywhere in particular.
OTOH, it'd be intuitively useful that it jumps to the first occurrence of
::foo
inother.namespace
.Maybe
other.namespace
has more occurrences of::foo
but we pick the first one because that's the best-effort thing to do.If
other.namespace
had no occurrences of::foo
, we'd still jump to that namespace, it's very probably what the user wants. The user could have a look in the namespace and check himself that there are no occurrences of ::foo - that's still a useful activity when programming.Cheers - Victor
The text was updated successfully, but these errors were encountered: