Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dirac #167

Closed
kurtharriger opened this issue Jan 10, 2018 · 6 comments
Closed

dirac #167

kurtharriger opened this issue Jan 10, 2018 · 6 comments

Comments

@kurtharriger
Copy link

I was trying to see if I could get the dirac chrome extension working but seem to be running into some issues:

https://github.com/binaryage/dirac/blob/master/docs/installation.md

{:dependencies [[re-frame "0.10.3-alpha2"]
                [day8.re-frame/trace "0.1.14"]
                [binaryage/devtools "0.9.8"]
                [binaryage/dirac "1.2.24"]
                [cider/cider-nrepl "0.16.0"]]

 :source-paths ["dev" ;; user.clj - see below
                "src/cljs"
                "src/cljc"]

 :nrepl {:port 8230 ;; dirac expects this port
         :nrepl-middleware [cider.nrepl.middleware.apropos/wrap-apropos
                            cider.nrepl.middleware.classpath/wrap-classpath
                            cider.nrepl.middleware.complete/wrap-complete
                            cider.nrepl.middleware.debug/wrap-debug
                            cider.nrepl.middleware.format/wrap-format
                            cider.nrepl.middleware.info/wrap-info
                            cider.nrepl.middleware.inspect/wrap-inspect
                            cider.nrepl.middleware.macroexpand/wrap-macroexpand
                            cider.nrepl.middleware.ns/wrap-ns
                            cider.nrepl.middleware.spec/wrap-spec
                            cider.nrepl.middleware.pprint/wrap-pprint
                            cider.nrepl.middleware.pprint/wrap-pprint-fn
                            cider.nrepl.middleware.refresh/wrap-refresh
                            cider.nrepl.middleware.resource/wrap-resource
                            cider.nrepl.middleware.stacktrace/wrap-stacktrace
                            cider.nrepl.middleware.test/wrap-test
                            cider.nrepl.middleware.trace/wrap-trace
                            cider.nrepl.middleware.out/wrap-out
                            cider.nrepl.middleware.undef/wrap-undef
                            cider.nrepl.middleware.version/wrap-version
                            dirac.nrepl/middleware]}

...

I wasn't sure how to configure agent to start automatically in shadow-cljs so I created a user.clj on classpath with following

(ns user
  (:require [shadow.cljs.devtools.api :as dapi]
            [dirac.agent :as dagent]))

(defn cljs-repl []
  (dagent/boot!)
  (dapi/nrepl-select :browser))

The installation docs mention that it uses a fork of piggyback and I believe shadow-cljs does as well. Does this mean I can't use dirac https://github.com/binaryage/dirac/blob/master/docs/installation.md#start-nrepl-server

-----------------------------------------------------------------------------------------------------------
WARNING!
We detected unexpected middleware setup in your nREPL server at nrepl://localhost:8230!
The difference (clojure.data/diff expected-ops reported-ops) is:
[[:clone
  :close
  :describe
  :dirac-devtools-request
  :eval
  :identify-dirac-nrepl-middleware
  :interrupt
  :load-file
  :ls-sessions
  :stdin]
 [:apropos
  :cider-version
  :classpath
  :clone
  :close
  :complete
  :complete-doc
  :complete-flush-caches
  :debug-input
  :debug-instrumented-defs
  :debug-middleware
  :describe
  :eldoc
  :eldoc-datomic-query
  :eval
  :format-code
  :format-edn
  :info
  :init-debugger
  :inspect-get-path
  :inspect-next-page
  :inspect-pop
  :inspect-prev-page
  :inspect-push
  :inspect-refresh
  :inspect-set-page-size
  :interrupt
  :load-file
  :ls-sessions
  :macroexpand
  :ns-list
  :ns-list-vars-by-name
  :ns-load-all
  :ns-path
  :ns-vars
  :ns-vars-with-meta
  :out-subscribe
  :out-unsubscribe
  :pprint-middleware
  :refresh
  :refresh-all
  :refresh-clear
  :resource
  :resources-list
  :retest
  :spec-example
  :spec-form
  :spec-list
  :stacktrace
  :stdin
  :test
  :test-all
  :test-stacktrace
  :toggle-trace-ns
  :toggle-trace-var
  :track-state-middleware
  :undef
  :cljs/select]
 nil]

For reference, the reported versions by the nREPL server are:
{:clojure "1.9.0", :java "1.8.0_131", :nrepl "0.2.13"}

This usually happens when some extra middleware gets injected into your nREPL server behind your back.
e.g. * Didn't you include a middleware via ~/.lein/profiles.clj or BOOT_HOME/boot.properties?
     * Or maybe using Cider's nREPL stuff?
     * Or maybe using some combination of ancient Clojure/Java versions?
     * Or some bleeding-edge alpha versions?
     * Or a rogue tools.nrepl dependency in your project or its dependencies?

Please follow Dirac installation instructions: https://github.com/binaryage/dirac#start-nrepl-server.
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
ERROR!
Dirac nREPL middleware is not present in your nREPL server at nrepl://localhost:8230!
Didn't you forget to add :nrepl-middleware [dirac.nrepl/middleware] to your :repl-options?
Please follow Dirac installation instructions: https://github.com/binaryage/dirac#start-nrepl-server.
-----------------------------------------------------------------------------------------------------------
@kurtharriger
Copy link
Author

Here is a project reproducing issue https://github.com/kurtharriger/shadow-cljs-examples/tree/dirac

@thheller
Copy link
Owner

thheller commented Jan 10, 2018

Try

{:dependencies [[re-frame "0.10.3-alpha2"]
                [day8.re-frame/trace "0.1.14"]
                [binaryage/devtools "0.9.8"]
                [binaryage/dirac "1.2.24"]
                [cider/cider-nrepl "0.16.0"]]

 :source-paths ["dev" ;; user.clj - see below
                "src/cljs"
                "src/cljc"]

 :nrepl {:port 8230 ;; dirac expects this port
         :middleware
         [cider.nrepl/wrap-apropos
          cider.nrepl/wrap-classpath
          cider.nrepl/wrap-complete
          cider.nrepl/wrap-debug
          cider.nrepl/wrap-format
          cider.nrepl/wrap-info
          cider.nrepl/wrap-inspect
          cider.nrepl/wrap-macroexpand
          cider.nrepl/wrap-ns
          cider.nrepl/wrap-spec
          cider.nrepl/wrap-pprint
          cider.nrepl/wrap-pprint-fn
          cider.nrepl/wrap-refresh
          cider.nrepl/wrap-resource
          cider.nrepl/wrap-stacktrace
          cider.nrepl/wrap-test
          cider.nrepl/wrap-trace
          cider.nrepl/wrap-out
          cider.nrepl/wrap-undef
          cider.nrepl/wrap-version
          dirac.nrepl/middleware]}}

cider changed the namespaces of the middleware.

@kurtharriger
Copy link
Author

Okay so this mostly works, but still getting some errors along the way.

After replacing with the above (I was also using nrepl-middleware instead of middleware which may also have contributed to the problem), I still get error in the repl complaining about unexpected middleware... but the agent does still connect and start!

The browser extension now connects to the agent, but I get the following analysis error after it connects.

screen shot 2018-01-11 at 8 35 47 am

That said it seems to allow me to eval basic clojure expressions so maybe the above errors aren't blockers.

@thheller
Copy link
Owner

I don't have the slightest clue what dirac is doing and can't figure it out by briefly going over the sources. It does seem to interface directly with cljs.analyzer at which point shadow-cljs is out of the picture.

@darwin
Copy link
Contributor

darwin commented Mar 16, 2018

Dirac is using its own fork of piggieback and weasel.

For conceptual overview please look here:
https://github.com/binaryage/dirac/blob/master/docs/about-repls.md#dirac

@darwin
Copy link
Contributor

darwin commented Jan 15, 2020

FYI issue #636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants