afucher / clojure-repl-intellij

Free OpenSource IntelliJ plugin for Clojure REPL development.
MIT License
59 stars 9 forks source link

Cannot evaluate expression in CLJS file #45

Closed gerdint closed 5 months ago

gerdint commented 6 months ago
  1. Load my project into IntelliJ (deps.edn+shadow-cljs)
  2. Run `npx shadow-cljs watch app
  3. Start a remote Clojure REPL and connect to NREPL port
  4. Open SPA in browser
  5. Execute (shadow.cljs.devtools.api/repl :app) in REPL
  6. Test REPL connection: (js/alert "Foo") -> works
  7. Try to evaluate some code from a CLJS file using Tools->Eval last sexp

Expected result: inline result of evaluation (or expression sent and evaluated in REPL) Actual result: Tooltip with error: => Execution error (NullPointerException) at nrepl.middleware.interruptible-eval/evaluate$fn$fn (interruptible_eval.clj:87). Cannot invoke "clojure.lang.Namespace.getMapping(clojure.lang.Symbol)" because the return value of "clojure.lang.Compiler.currentNS()" is null

If it's relevant I also had another remote Clojure REPL connected to my backend NREPL server.

ericdallo commented 5 months ago

@gerdint we fixed a bug where Eval last sexpr was not using the same context of other evals, could you try again with the latest plugin version? Also, if doesn't work, could you provide a sample repo project? usually I use https://github.com/ericdallo/clojure-sample to test things, there is even a shadow-cljs branch there

gerdint commented 5 months ago

So now it seems like the expression is sent to the REPL, and I get a result as a tooltip in the editor which is the intented behaviour I guess, good!

@ericdallo Though the REPL window has black text och very dark grey background, any idea on how to tweak this? In the screenshots the text is light gray, no idea why it's black in my case.

The sample project only contains CLJ files it seems. When I create a "Clojure Local" run config and try to eval statements all I get are empty results in the tooltip, but that would be another issue so closing this one.

ericdallo commented 5 months ago

@gerdint currently the color of the repl console is hardcoded here, feel free to create a issue or work on that customization support