Published a new version of Chlorine, fixing these problems with goto-var-definition. Also, added a test so hopefully there won't be regressions in the future 🙂
Go to var definition still doesn't work for me in most cases.
It'll go to Clojure core function definitions (where I get a Joker error, saying joker
isn't on my path -- except it is and Joker works fine while I'm editing files).
But it won't go to any definitions in files in my own code.
If I "inspect var" (sending #'<varname>
to REBL), it shows the filename, line, and column in the metadata for the var correctly, so Clojure seems to know where the definition is, just not Chlorine. @mauricio.szabo
Can you print the Joker error you're getting? (I'm not even using Joker btw...)
[Linter] Error running joker Error: Failed to spawn command `joker`. Make sure `joker` is installed and on your PATH
at /Users/sean/.atom/packages/linter-joker/node_modules/atom-linter/lib/helpers.js:130:24
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Oh, I think that immediately follows this one
Uncaught Error: write EPIPE
at _errnoException (util.js:1024:11)
at WriteWrap.afterWrite (net.js:867:14)
from events.js
183.Console actually shows three errors: that first one (Error running joker), then the EPIPE one, then the Error running joker again. And I do get two red popup errors that correspond to the Error running joker.
There's no error in the Console when Chlorine fails to go to a var def in my code (just the red popup Could not find definition for var).
If it helps debug the problem: I printed d
and r(d)
(from the compiled JS) and d
is null
.
Which, mapping back to the cljs code, seems to indicate the logic for finding the var returned nil
...
Ah, narrowed it down a bit further! If I try it on a qualified symbol, it does work. It only doesn't work for unqualified symbols that are defined in the same namespace.
If I do it on an unqualified symbol that has been referred in, I get to the correct source, but I do get the Joker error.
If I do it on a qualified symbol, I get to the correct source but I do not get the Joker error.
That's probably why the problem didn't show up in your testing. Guess it's not a major issue. I may try going back to a from-source build next week and adding some more debugging to see if I can figure out what's up (unless you figure it out before then).
Oh, thanks for the detailed info! I'll look at this issue tomorrow, and see if I can find anything! Also, what version of Clojure are you using in this project? (What I find really strange is that there's no usage of Joker in Chlorine....)
I have joker lint installed, so I'd expect it to run when a change is made or when a new file is first loaded. However, if I load the file myself, instead of it being loaded by Chlorine's go-to-var, then Joker runs just fine. So maybe something weird about how Chlorine gets Atom to load files? And weirdly only for unqualified symbols (e.g., map
from `clojure.core).
Clojure version is the latest: 1.10.1-rc1 (we already have it in production for several of our services).
Okay, I was able to reproduce. Will check what's happening
Thanks for the help! I'm thinking on enabling source maps on release builds, so these problems will be easier to debug too...