tpope / vim-fireplace

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

Nashorn support for Piggieback #243

Closed vitvly closed 6 years ago

vitvly commented 8 years ago

Hi,

i was trying to check if it were possible to select Nashorn instead of Rhino when running on JDK 8+, came up with this in s:repl.piggieback() function (line 279):

  if empty(a:arg)
    let java_version = connection.eval('(System/getProperty "java.version")')
    if has_key(java_version, 'value') && split(java_version['value'], '\.')[1] >= 8
      call connection.eval("(require 'cljs.repl.nashorn)")
      let arg = '(cljs.repl.nashorn/repl-env)'
    else
      let arg = '(cljs.repl.rhino/repl-env)'
    endif

When running :Piggieback the output ofconnection.eval('(cemerick.piggieback/cljs-repl'.' '.arg.')') call is:

[['status', ['done']], ['id', 'fireplace-123456789'], ['out', 'To quit,
type: :cljs/quit^@'], ['session', ['581826c7-cbfb-4406-a585-8d6c6ce981d5']], ['ns', 'cljs.user'], ['v
alue', 'nil']]

Seems to be fine. But, when trying to eval some ClojureScript form the next error is thrown:

{'status': ['eval-error', 'done'], 'ex': 'class clojure.lang.ExceptionInfo', 'root-ex': 'class clojur
e.lang.ExceptionInfo', 'id': 'fireplace-123456789', 'session': ['56a98f2a-25f6-4933-
965d-533064f193d1'], 'err': 'TypeError: Cannot read property "getStackTrace" from undefined^@^I (NO_S
OURCE_FILE <eval>:1:0)^@^I (NO_SOURCE_FILE <eval>:1:0)^@^I (NO_SOURCE_FILE <eval>:1:0)^@'}

Why is that? I don't quite understand how to debug this error further - can you please provide some directions?

Thanks!

gavocanov commented 8 years ago

same here

geraldodev commented 8 years ago

@siphiuel,

Are you managing to establish a talk between fireplace and figwheel ? If so, can you post the project.clj ?

Regards,

Geraldo

2015-11-19 12:06 GMT-02:00 Paolo Gavocanov notifications@github.com:

same here

— Reply to this email directly or view it on GitHub https://github.com/tpope/vim-fireplace/issues/243#issuecomment-158065941 .

gavocanov commented 8 years ago

After lein figwheel in bash i do :Connect nrepl://localhost:7888 in vim and that works (if using 0.10 SNAPSHOTS of cider I get shitloads of errors, but with 0.9.x works ok).

I have piggieback and cider stuff in my ~/.lein/profiles.clj:

{:user{
       :dependencies [
                      [cider/cider-nrepl "0.9.1"]
                      ;; [refactor-nrepl "2.0.0-SNAPSHOT"]
                      [com.cemerick/piggieback "0.2.1"]
                      [org.clojure/tools.nrepl "0.2.10"]
                      [weasel "0.7.0" :exclusions [org.clojure/clojurescript]]
                      ]
       :figwheel {
                  :nrepl-port       7888
                  :nrepl-middleware [
                                     "cider.nrepl/cider-middleware"
                                     ;; "refactor-nrepl.middleware/wrap-refactor"
                                     "cemerick.piggieback/wrap-cljs-repl"
                                     ]
                  }
       }
 }

I get the same error as you when I try to do :Piggieback and then try to evaluate anything.

I included weasel now in my test project and connecting to it ATM, that works fine as a workaround.