avli / clojureVSCode

Clojure support for Visual Studio Code
https://avli.github.io/clojureVSCode/
MIT License
204 stars 34 forks source link

Can't slurp file with repl eval #77

Open johnjelinek opened 7 years ago

johnjelinek commented 7 years ago

Given this code:

(defn process-file [fname]
  (slurp (clojure.java.io/resource fname)))

(process-file "hello.txt")

and this file in resources/hello.txt:

Hello Resources!

When I eval Then I get a stacktrace:

clojure.lang.Compiler$CompilerException java.lang.IllegalArgumentException: Cannot open <nil> as a Reader.
 at null:69:22
    clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3657)
    clojure.lang.Compiler$DefExpr.eval (Compiler.java:451)
    clojure.lang.Compiler.eval (Compiler.java:6932)
    clojure.lang.Compiler.load (Compiler.java:7379)
    clojure.lang.Compiler.eval (Compiler.java:6927)
    clojure.lang.Compiler.eval (Compiler.java:6890)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__5508.invoke (interruptible_eval.clj:87)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:85)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:55)
    clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__5553$fn__5556.invoke (interruptible_eval.clj:224)
    clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__5548.invoke (interruptible_eval.clj:192)

This works without issue in a lein repl.

avli commented 6 years ago

@johnjelinek could you check if the issue still persists in the latest version of the extension? It seems like Clojure can't find the file for some reason. Can it be the case that you redefine the Leiningen resource-paths variable somewhere?