-
-
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-symbol-at-point does not return ns-qualified keyword to re-jump.el #2912
Comments
I'm assuming that the issue is that you need a resolved symbol and
Might be that the problem is on the middleware side, indeed. I think it'd be best to run those commands with Emacs's debugger and get a better picture of what's happening https://docs.cider.mx/cider/0.26/troubleshooting.html#debugging-cider-commands |
Thanks for the response, @bbatsov !
Yes, that is correct.
It doesn't appear to... that's what has stumped me.
I observed this with both: println style debugging and with edebug step through. Maybe I am doing something wrong. I'll dig more and report back. Cheers! |
Hi, I introduced this change in #2826 and didn't consider how macroexpansion would work in Clojurescript (which I don't use on a regular basis) In any case it's probably the wrong abstraction to use - can you try editing ;; resolve ns-aliased keywords
(when (string-match-p "^::.+" str)
- (setq str (or (ignore-errors (cider-sync-request:macroexpand "macroexpand-1" str)) "")))
+ (setq str (or (nrepl-dict-get (cider-sync-tooling-eval str (cider-current-ns))
+ "value")
+ ""))) |
@yuhan0 thank you for your reply. I tried with your modifications, and stepped through with edebug. Now
I haven't investigated beyond this. |
@yuhan0 Using ;; resolve ns-aliased keywords
(when (string-match-p "^::.+" str)
- (setq str (or (ignore-errors (cider-sync-request:macroexpand "macroexpand-1" str)) "")))
+ (setq str (or (nrepl-dict-get (cider-nrepl-sync-request:eval str (cider-current-connection) (cider-current-ns))
+ "value")
+ ""))) For comparison, if I apply the diff in this comment: #2912 (comment), then I experience the error noted here: #2912 (comment)
It looks like I suppose this is because the Also, the tooling eval function appears to disconnect the |
Do we have any news about this? I find it would be great to have this one working. |
The workaround in this comment worked for me, but I'm not sure if it's a proper fix. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding! |
This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it. |
I'm having trouble getting
re-jump.el
to work in context of a re-frame app. It might have to do withcider-symbol-at-point
.re-jump.el provides emacs navigation for re-frame projects. It helps jump to re-frame effect registrations, which are basically namespace-qualified keywords. Ref. its README for an example https://github.com/oliyh/re-jump.el
re-jump relies on
cider-symbol-at-point
to give it a fully-qualified keyword, which feeds into a regex-based search, to jump to definition.And I think
cider-find-keyword
is broken for me, for the same reason.Expected behavior
Using re-jump.el as of SHA 443ddfa33dd2ae593cc0a013d16fff21f2afd925
cider-symbol-at-point
should return a fully namespace qualified keyword to re-jump.el when we callM-x re-frame-jump-to-reg
orM->
.Actual behavior
cider-symbol-at-point
returns an empty string to re-jump.el.At one point I thought refactor-nrepl might be interfering, but I am able to reproduce the problem without refactor-nrepl too.
Steps to reproduce the problem
Setting up an exact replica of my project may be too much. I suspect this is a general problem that will reproduce within any clojurescript project, given the software versions documented below.
A bit of debugging inside
cider-util.el/cider-symbol-at-point
suggests the function is able to extract the keyword with(thing-at-point 'symbol)
. But, it appears to not macroexpand the keyword in a clojurescript nREPL.ref: https://github.com/clojure-emacs/cider/blob/master/cider-util.el#L134
I found macroexpanison returns nil. I observed this with println style debugging and with edebug step through.
The regex string-match appears to work, but then,
cider-sync-request:macroexpand
appears to return nil.When stepping through, I noticed
str
seems to get bound to a fontified structure.I tried to remove font lock, and re-tried step through. Now
str
gets set to"::my-target-event-registration"
, but still no dice... macroexpansion still returns nil.This is the limit of my emacs-fu, I'm afraid... I'll need help to debug this further to find a fix.
Looking through commit history, I noticed the above keyword-expansion behaviour was added here (starting line 132 in cider-util.el): https://github.com/clojure-emacs/cider/pull/2826/files#diff-21ccb709cb3dcff7d2b47a250e64c363ca182b5a3155ab034ce6743fec58fa03R132
Note: I start the repl in my terminal and connect from Emacs with
cider-connect-cljs
. The exact REPL invocation is:Environment & Version information
CIDER version information
Middleware:
Lein/Boot version
Emacs version
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.13) of 2019-12-24
Operating system
Ubuntu 20.04.1 LTS
The text was updated successfully, but these errors were encountered: