tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.74k stars 139 forks source link

Tips for debugging fireplace#path() #333

Closed b-ryan closed 5 years ago

b-ryan commented 5 years ago

I can't get fireplace#path() to output anything so jump to source is not working. I have tried a few things, but I'm at a loss as to how to debug further.

There are some oddities about my setup, like:

This doesn't help much, but I have two machines where I'm running this code and on my desktop things were working fine yesterday. But I must have changed something because today it stopped working. But I can't figure out what changed.

Is there any general checklist I should run through for figuring this out?

kovasap commented 5 years ago

i had this same issue, and #332 fixed it for me kind of - i am still having trouble with code in my own project with that change. i will probably make further modifications or close that PR with the solution I come to when I figure it out. i am not running in a container though...

tpope commented 5 years ago

The primary way Fireplace gets the path is to ask the REPL server, using either the Cider classpath op or ((System/getProperty "java.class.path"), and then check that the current file appears somewhere in it. This won't generally work in a Docker setup, because the class path inside the container is different from the class path outside of it. If the current file doesn't appear to be part of the REPL's classpath, the fallback strategy is to check the 'path' option, which is set by plugins like salve.vim.

Do you have salve.vim installed? What is the output of :verbose set path??

b-ryan commented 5 years ago

Sorry for the delay - I have been trying out a few different things. Things started working again on my laptop fairly consistently. On my desktop they also started working but then reverted back to not working. It seemed like after my machine restarted is when it began working.

I do have salve.vim installed in both places.

So at the moment fireplace#path() is back to being empty. The output of :verbose set path? is:

path=/app/test,/app/dev/src,/app/src,/app/dev/resources,/app/dev-resources,/app/resources,/app/target/default/classes,/app/local-m2/joda-time/joda-time/2.10/joda-time-2.10.jar,/app/local-m2/org/apache/httpcomponents/httpclient/4.5.5/
httpclient-4.5.5.jar,/app/local-m2/ring/ring-core/1.7.1/ring-core-1.7.1.jar,/app/local-m2/com/taoensso/timbre/4.10.0/timbre-4.10.0.jar,/app/local-m2/clojure-complete/clojure-complete/0.2.5/clojure-complete-0.2.5.jar,/app/local-m2/org/c
lojure/core.async/0.4.474/core.async-0.4.474.jar,/app/local-m2/com/amazonaws/aws-java-sdk-sts/1.11.495/aws-java-sdk-sts-1.11.495.jar,/app/local-m2/cc/qbits/commons/0.5.1/commons-0.5.1.jar,/app/local-m2/instaparse/instaparse/1.4.8/insta
parse-1.4.8.jar,/app/local-m2/org/apache/httpcomponents/httpcore-nio/4.4.6/httpcore-nio-4.4.6.jar,/app/local-m2/tigris/tigris/0.1.1/tigris-0.1.1.jar,/app/local-m2/org/postgresql/postgresql/42.2.5/postgresql-42.2.5.jar,/app/local-m2/org
/apache/httpcomponents/httpcore/4.4.9/httpcore-4.4.9.jar,/app/local-m2/progrock/progrock/0.1.2/progrock-0.1.2.jar,/app/local-m2/com/amazonaws/jmespath-java/1.11.495/jmespath-java-1.11.495.jar,/app/local-m2/software/amazon/ion/ion-java/
1.0.2/ion-java-1.0.2.jar,/app/local-m2/clj-http/clj-http/3.9.1/clj-http-3.9.1.jar,/app/local-m2/org/clojure/tools.macro/0.1.5/tools.macro-0.1.5.jar,/app/local-m2/org/clojure/clojure/1.10.0/clojure-1.10.0.jar,/app/local-m2/org/slf4j/slf
4j-api/1.7.25/slf4j-api-1.7.25.jar,/app/local-m2/org/elasticsearch/client/elasticsearch-rest-client-sniffer/6.3.1/elasticsearch-rest-client-sniffer-6.3.1.jar,/app/local-m2/com/taoensso/truss/1.5.0/truss-1.5.0.jar,/app/local-m2/org/cloj
ure/java.jdbc/0.7.8/java.jdbc-0.7.8.jar,/app/local-m2/compojure/compojure/1.6.1/compojure-1.6.1.jar,/app/local-m2/expound/expound/0.7.1/expound-0.7.1.jar,/app/local-m2/com/amazonaws/aws-java-sdk-core/1.11.495/aws-java-sdk-core-1.11.495
.jar,/app/local-m2/com/cemerick/url/0.1.1/url-0.1.1.jar,/app/local-m2/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3.jar,/app/local-m2/com/mchange/mchange-commons-java/0.2.11/mchange-commons-java-0.2.11.jar,/app/l
ocal-m2/net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar,/app/local-m2/org/clojure/tools.analyzer/0.6.9/tools.analyzer-0.6.9.jar,/app/local-m2/org/clojure/tools.reader/0.10.0/tools.reader-0.10.0.jar,/app/local-m2/org/clojure/test.check/0
.9.0/test.check-0.9.0.jar,/app/local-m2/com/fzakaria/slf4j-timbre/0.3.12/slf4j-timbre-0.3.12.jar,/app/local-m2/ring/ring-codec/1.1.1/ring-codec-1.1.1.jar,/app/local-m2/nrepl/nrepl/0.6.0/nrepl-0.6.0.jar,/app/local-m2/com/amazonaws/aws-j
ava-sdk-kms/1.11.495/aws-java-sdk-kms-1.11.495.jar,/app/local-m2/mvxcvi/arrangement/1.1.1/arrangement-1.1.1.jar,/app/local-m2/fipp/fipp/0.6.13/fipp-0.6.13.jar,/app/local-m2/org/clojure/tools.cli/0.4.1/tools.cli-0.4.1.jar,/app/local-m2/
commons-io/commons-io/2.6/commons-io-2.6.jar,/app/local-m2/cli-matic/cli-matic/0.3.6/cli-matic-0.3.6.jar,/app/local-m2/com/stuartsierra/component/0.4.0/component-0.4.0.jar,/app/local-m2/medley/medley/1.0.0/medley-1.0.0.jar,/app/local-m
2/ring/ring-mock/0.3.2/ring-mock-0.3.2.jar,/app/local-m2/crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0.jar,/app/local-m2/org/clojure/math.numeric-tower/0.0.4/math.numeric-tower-0.0.4.jar,/app/local-m2/com/fasterxml/jackso
n/core/jackson-annotations/2.6.0/jackson-annotations-2.6.0.jar,/app/local-m2/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar,/app/local-m2/clojure/jdbc/clojure.jdbc-c3p0/0.3.3/clojure.jdbc-c3p0-0.3.3.jar,/app/local-m2/c
ommons-codec/commons-codec/1.11/commons-codec-1.11.jar,/app/local-m2/org/apache/httpcomponents/httpmime/4.5.5/httpmime-4.5.5.jar,/app/local-m2/org/clojure/core.memoize/0.5.9/core.memoize-0.5.9.jar,/app/local-m2/potemkin/potemkin/0.4.5/
potemkin-0.4.5.jar,/app/local-m2/http-kit/http-kit/2.3.0/http-kit-2.3.0.jar,/app/local-m2/ring/ring-json/0.4.0/ring-json-0.4.0.jar,/app/local-m2/org/clojure/math.combinatorics/0.1.4/math.combinatorics-0.1.4.jar,/app/local-m2/clout/clou
t/2.2.1/clout-2.2.1.jar,/app/local-m2/riddley/riddley/0.1.12/riddley-0.1.12.jar,/app/local-m2/org/clojure/c                                                                                                                                
        Last set from ~/src/dotfiles/home/vim/plugged/vim-salve/plugin/salve.vim

Those /app routes are container paths. The path on the host is inside my home directory.

b-ryan commented 5 years ago

Oh interestingly on my laptop, the fireplace path is working and :verbose set path? is showing the paths of my host.

tpope commented 5 years ago

The way salve.vim sets 'path' is to use the nrepl connection if available, or a command like lein -o classpath if not, and caches the result based on the timestamp of project.clj. Unlike in Fireplace, there is no sanity check that the path corresponds to the local file system. I assume this is an oversight. The caching is probably confounding your attempts to debug. It can be found in ~/.cache/vim/classpath if you want to clear it out.

tpope commented 5 years ago

I've added the missing sanity check to salve.vim.