Closed rpkarlsson closed 5 years ago
Did a workaround available at: https://github.com/rpkarlsson/cider/commit/68c2ff09b567932823c82eed74c7c22221c93d3a, but I feel that the fix perhaps should be done directly in nREPL instead?
nREPL's cider-sync-request:ns-path
returns file:/path/to/jar.jar!/path/file.clj"
instead of the expected jar:file:/path/to/jar.jar!/path/file.clj"
Seems like some bug in Orchard or cider-nrepl. There were a lot of changes there recently. //cc @arichiardi @jeffvalk
Doing some digging the bug seems to be introduced with the changes in: https://github.com/clojure-emacs/orchard/commit/ddd6aeaa58f7f3fbc259a7fcc317ab6bf9643615#diff-015a5738d798be18495eaebdc7362ee8L106
Changing nREPL to use the new orchard.ns/canonical-source
was done in https://github.com/clojure-emacs/cider-nrepl/commit/49462f13c5a87ff071551150cc6ceb61ef967c8c#diff-5f80328b3910bd3a21646a0c244ba0b3R88.
orchard.ns/canonical-source
returns clojure.java.io
data so I'm reluctant to change anything on that side. I'm thinking nREPL could handle things like this https://github.com/rpkarlsson/cider-nrepl/commit/2d955e06a56646cb332175100a56bc0ffaa5be7e
Would that be an OK solution or do you have any thoughts/suggestions? At least feels better than the initial workaround where cider checked the string directly.
orchard.namespace
has tests (here) to validate that canonical-source
finds namespaces in jar files. You can check this by invoking that function directly, e.g.:
(cider.nrepl.inlined-deps.orchard.v0v5v0-beta9.orchard.namespace/canonical-source
'clojure.data) ; Provided you have the source on your classpath
If that fails, some assumption of orchard.namespace
has been violated. But I suspect the problem is downstream of this.
orchard.namespace
finds the source. It's that .getPath
seems to be missing the "jar:" prefix.
cider.nrepl.middleware.ns/ns-path
does something like:
(.getPath (orchard.namespace/canonical-source 'clojure.string))
; => "file:/home/rpkarlsson/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar!/clojure/string.clj"
Cider expects that path to be "jar:file:[...]"
.
Seems Cider should be calling (str ...)
rather than (.getPath ...)
on the result of canonical-source
.
cider-find-ns
can't open files in jars and throws an error instead.Expected behavior
That a buffer containing the ns is opened.
Actual behavior
The previouly opened buffer is focused and the following error is shown
Steps to reproduce the problem
M-x cider-find-ns
Environment & Version information
CIDER version information
Lein/Boot version
clojure-cli
Emacs version
26.2
Operating system
Fedora 30