Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Fix jump to source, close #3#27

Merged
ibdknox merged 1 commit intoLightTable:masterfrom
cldwalker:fix-jump-to-definition
Oct 24, 2014
Merged

Fix jump to source, close #3#27
ibdknox merged 1 commit intoLightTable:masterfrom
cldwalker:fix-jump-to-definition

Conversation

@cldwalker
Copy link
Copy Markdown
Member

This fixes jump to source for jar files in clojure and clojurescript.
This also fixes jumping to src-paths in clj e.g. lighttable/nrepl/eval.clj.
I opted to unpack jarfiles to a consistent tempfile. I thought it would be helpful to cache created tempfiles to avoid unpacking each time and to allow dependencies to have temporary modifications

Following jumps should now work:

  • clj - macros, clj core, dependencies, anything on src-paths
  • cljs - cljs core, dependencies, anything on src-paths
    Note: cljs macros via :require-macros don't work because there's no metadata on them.

To QA this, lein install in lein-light-nrepl/.

@ibdknox Could you give me permissions to release lein-light-nrepl on clojars? I believe you'd need to add me, cldwalker, to the group page.

This fixes jump to source for jar files in clojure and clojurescript.
This also fixes jumping to src-paths in clj e.g. lighttable/nrepl/eval.clj.
@cldwalker cldwalker force-pushed the fix-jump-to-definition branch from ec3920f to 12fcaad Compare October 24, 2014 17:59
@ibdknox
Copy link
Copy Markdown
Member

ibdknox commented Oct 24, 2014

@cldwalker added.

@ibdknox
Copy link
Copy Markdown
Member

ibdknox commented Oct 24, 2014

Awesome work.

@jsa-aerial
Copy link
Copy Markdown

Hi,

Just tried this by requiring lein-light-nrepl 0.0.19 (which was just pushed and I believe has this fix - maybe I am wrong about that??). I'm running server remotely and connecting from LT. Now many commands give these sort of exceptions in the server.

;; Examples: toggle doc on form or jump to src on form give
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createTempFile(File.java:1879)
at java.io.File.createTempFile(File.java:1923)
at lighttable.nrepl.doc$jar_url__GT_file.invoke(doc.clj:59)
at lighttable.nrepl.doc$resolve_file.invoke(doc.clj:76)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$update_in.doInvoke(core.clj:5587)
at clojure.lang.RestFn.invoke(RestFn.java:445)
at lighttable.nrepl.doc$eval5957$fn__5959.invoke(doc.clj:116)
at clojure.lang.MultiFn.invoke(MultiFn.java:227)
at lighttable.nrepl.core$queued$fn__1870.invoke(core.clj:98)
at clojure.core$comp$fn__4154.invoke(core.clj:2330)
at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__652.invoke(interruptible_eval.clj:138)
at clojure.lang.AFn.run(AFn.java:24)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

;; Try jump to src:

@cldwalker
Copy link
Copy Markdown
Member Author

@jsa-aerial You have the correct version. It seems from this java issue, the issue comes from the java temp directory not existing. Could you check what the temp directory is with (System/getProperty "java.io.tmpdir"), create it with mkdir -p INSERT_TEMP_DIR and then jump to source again? If that resolves your issue, then I can put a fix in for others

@jsa-aerial
Copy link
Copy Markdown

Hi Gabriel,

I've never had an issue with temp files before, and from this:

user=> (System/getProperty "java.io.tmpdir")
"/tmp"
user=>

we see it is just the usual /tmp system directory (this is on Ubuntu) and
from this ls
..
drwxr-xr-x 13 root root 0 Oct 15 16:27 sys/
drwxrwxrwt 13 root root 12288 Oct 28 13:09 tmp/
drwxr-xr-x 11 root root 4096 Oct 6 2013 usr/
...
we see it is world writable, so should not be an issue. Certainly I can
create temp files in it as well:

user=> (import java.io.File)
java.io.File
user=> (File/createTempFile "TEST" "")
#<File /tmp/TEST5098048312151530150>
user=>

But I still get the same error if trying doc or jumping to src (not
surprising since didn't change anything)

On Tue, Oct 28, 2014 at 12:45 PM, Gabriel Horner notifications@github.com
wrote:

@jsa-aerial https://github.com/jsa-aerial You have the correct version.
It seems from this java issue
https://bugs.openjdk.java.net/browse/JDK-8046016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel,
the issue comes from the java temp directory not existing. Could you check
what the temp directory is with (System/getProperty "java.io.tmpdir"),
create it with mkdir -p INSERT_TEMP_DIR and then jump to source again? If
that resolves your issue, then I can put a fix in for others


Reply to this email directly or view it on GitHub
#27 (comment).

@cldwalker
Copy link
Copy Markdown
Member Author

@jsa-aerial The clojure plugin is also doing a File/createTempFile call. I'm guessing the reason it passes for the above and fails for the plugin is a difference in arguments, possibly one of them being nil or having spaces in the string. If you want to debug this, try the following:

  • Clone the clojure plugin and cd 'Clojure/lein-light-nrepl'
  • Add a print statement right before the line I linked above e.g. (prn "JUMP:" relative-name ext (.getPath jar-url))
  • Install the debugging clojar while in that directory with lein install
  • Start LightTable, open your console with command "Console: Toggle console" and jump to source
  • You should see the args in the console that are causing your issue

I'm happy to fix if I can get those debugging values

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants