clojure-emacs / sayid

A debugger for Clojure
Apache License 2.0
408 stars 27 forks source link

*sayid* buffer shows text without color or functionality #33

Open webappzero opened 7 years ago

webappzero commented 7 years ago

Tutorial worked fine for me, but now Sayid is failing to work on my own project. The workspace text is not colored and none of the keyboard shortcuts work. For example, pressing i fails to inspect node, it just types the letter i.

I'm assuming there must be some difference in setup between my project and the tutorial, but my stabs in the dark failed. I added the following line to my project.clj:

:repl-options {:nrepl-middleware [com.billpiel.sayid.nrepl-middleware/wrap-sayid]}

My project is called assembler. I created with lein new app assembler.

Here is the my entire project.clj file:

(defproject assembler "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]]
  :main ^:skip-aot assembler.core
  :target-path "target/%s"
  :repl-options {:nrepl-middleware [com.billpiel.sayid.nrepl-middleware/wrap-sayid]}
  :profiles {:uberjar {:aot :all}})

And here is my ~/.lein/profiles.clj

{:repl {:plugins [[cider/cider-nrepl "RELEASE"]
                  [refactor-nrepl "RELEASE"]]
        :dependencies [[alembic "RELEASE"]
                       [org.clojure/tools.nrepl "RELEASE"]
                       [com.cemerick/pomegranate "RELEASE"]
                       [zprint "RELEASE"]]
        :global-vars {*print-length* 1000}}
 :user {:plugins [[cider/cider-nrepl "RELEASE"]
                  [com.billpiel/sayid "RELEASE"]]
        :dependencies [[org.clojure/tools.nrepl "RELEASE"]]}}

I'm running Emacs Version 25.1 (9.0) with Spacemacs Release 0.200.9.

The error in the mini-buffer reads: Wrong type argument: listp, /././.

Here's a screenshot too: http://img.webappzero.com/kjgV

bpiel commented 7 years ago

@webappzero Thanks for reaching out. What do you get when you run emacs command sayid-version?

webappzero commented 7 years ago

M-x sayid-version returns clj=0.0.15 el=0.0.15

I'm currently chasing down a Cider version conflict that I just now noticed. Might be best to ignore this issue until I troubleshoot that first. Thank you. I'll be sure to follow up soon.

webappzero commented 7 years ago

Removing the (:gen-class) form from the ns form located in assembler.core corrected this issue.

The (:gen-class) form is automatically inserted there when using lein new app <app-name> to setup up a Clojure project. I'm not sure why this would conflict with Sayid, but it may be related to ahead of time compilation settings in project.clj.

In fact, I just successfully tested that idea by creating a new project with lein new <library-name>, which has the following vanilla project.clj file:

(defproject hackasm "0.0.1"
  :description "Write an assembler for the Hack Computer"
  :url "http://webappzero.com"
  :dependencies [[org.clojure/clojure "1.8.0"]])

So, it's not the (gen-class) form but something else, perhaps the aot settings listed above, with which I'm not very familiar.

That's it for my core issues. What follows is some feedback tangentially related to this issue that may prove helpful, or at least curious.

(Before I proceed, just want to say how awesome I think Sayid is. This is as close to debugging Nirvana as I've seen. Bill, your hard work is self-evident and greatly appreciated. I look forward to helping out more as my Clojure and programming skills strengthen.)

In the process of troubleshooting, I noticed that a recommendation made on Sayid's homepage appears contrary to best practices recommended in the Cider documentation.

Sayid's home pages shows the following example lein ~/.lein/profile.clj file:

{:user {:plugins [[cider/cider-nrepl "0.14.0"]
                   [com.billpiel/sayid "0.0.15"]]
         :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}

But Cider docs recommend:

You see a number like X.X.X, and you're starting the REPL with cider-jack-in

This means you're manually adding the cider-nrepl middleware in your project, but you shouldn't do that because cider-jack-in already does that for you. Look into the following files, and ensure you've removed all references to cider-nrepl and tools.nrepl: project.clj, build.boot, ~/.lein/profiles.clj and ~/.boot/profile.boot.

This was the cause of the Cider version conflict I mention in the post above. Cider was auto-injecting version 0.15.0-SNAPSHOT which mis-matched with Sayid's recommendation above, which prints this alarming message when jacking into Cider:

WARNING: CIDER's version (0.12.0) does not match cider-nrepl's version (...). Things will break!

At first, I just changed [cider/cider-nrepl "0.14.0"] to [cider/cider-nrepl "0.15.0-SNAPSHOT"] and the scary message went away and everything worked.

Next, I cleaned up my profiles.clj per the Cider docs and was left with:

{:repl {:plugins []
        :dependencies [[zprint "RELEASE"]]
        :global-vars {*print-length* 1000}}
:user {:plugins []
        :dependencies []}}

And my project.clj1 not like this:

(defproject hackasm "0.0.1"
  :description "Write an assembler for the Hack Computer"
  :url "http://webappzero.com"
  :profiles {:dev {:plugins [[com.billpiel/sayid "0.0.15"]]}}
  :dependencies [[org.clojure/clojure "1.8.0"]])

Everything I've tested (basic Sayid functionality), still works, but for some reason when I run sayid-version I now get:

Wrong type argument: sequencep, 0\.0\.15 Although when I look at the whole msg in Messages buffer I see:

0.0.15
funcall-interactively: Wrong type argument: sequencep, 0\.0\.15

I'll let you know if I notice anything else.

BTW, In my research, I've noticed conflicting recommendations for Cider nrepl setup are common. I suspect it has to do with this line on these lines from Cider nrepl's github page:

If you're just a user trying to get started with CIDER, then you probably don't want to read this. You should follow the steps in CIDER's Readme instead.

If you're trying to use cider-nrepl for some other purpose, the sections below outline how to include it in a project.

A minimal profiles.clj for CIDER would be:

{:user {:plugins [[cider/cider-nrepl "0.14.0"]]}}

My best : )

bpiel commented 7 years ago

@webappzero Thanks for experimenting and the thorough report! I'll take some time to digest and address all of that.

This is as close to debugging Nirvana as I've seen.

YES! So happy to hear this. Thanks

webappzero commented 7 years ago

Hmmm. The issue has returned and I'm at a complete loss as to why. There are no obvious culprits. I won't have time today to dig into causes, but will provide as much feedback as I can soon.

I can say that the new circumstances cause me to question the assumptions made above about aot being the cause.

holtzermann17 commented 4 years ago

Affected here on clj=0.0.17 el=0.0.18.

zheh12 commented 4 years ago

@bpiel @holtzermann17 @bbatsov @webappzero I found the root cause for the problem. The version in 0.0.18 for the code is broken.

For the el it use 0.0.18, for the clojure 0.0.18 version, it let the nrepl use 0.0.17. I submit a pull request https://github.com/clojure-emacs/sayid/pull/56 to fix this. @bpiel If you have some time, please merge the code and deploy a new version for the sayid.

@webappzero For now, you can just clone the code, and apply the patch, then lein install the jar local to fix the problem.