Fork me on GitHub

Running tests isn't behaving the way I expect. I have src and test directories in my classpath. If I cider-jack-in on a module in the src directory, and C-c C-t C-n, it reports that it can't find the corresponding test file. If I explicitly load C-c C-K the test file, then go back to the source file, and execute C-c C-t C-n, the tests run as expected. Is cider supposed to find and load the tests, or am I expected to load them manually?


What are the namespaces. It can do it if they are identical except for -test


They are identical except for -test. It works as expected if I explicitly load the -test namespace. Is cider supposed to load the -test namespace implicitly?


Cider will look for the test ns by tacking on "-test"


IF I cider-jack-in from file.clj, and C-c C-t C-n, it tells me no test namespace: file-test. If I go to file_test.clj and C-c C-k, then go back to file.clj and C-c C-t C-n, it runs the tests.


So, it looks as though it correctly identifies the namespace, but can't load it implicitly. If the namespace is loaded explicitly, it uses it.


Are you sure the test dir is on the class path for the current alias or profile?


Yes. My project's src and test directories are the first 2 entries shown by (println (clojure.string/join "\n" (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))) evaluated in the repl.


My deps.edn file has :paths ["src" "test"] I'll eventually want to move the test path to a dev alias :extra-paths, but I'm trying to keep things simple while I figure this out.


@vigilancetech Please, file some ticket about this so we won’t lose this conversation. I’m super busy these days and those Slack convos disappear too quickly.


how do I set the clojure cmd alias flags again?


I have to jot this down somewhere.




Oh sorry. Those are lein. And I agree these should be easier


@dpsutton @bhauman All those conversation make me wonder if we should have just a single config var per “build tool”.


Right now there’s command, params and global options for everything.


I think we modelled everything that exists after lein, as it was the first (and only) build tool we supported for quite a while.


Frankly, even I’m confused by what’s a global param and what’s an option. 🙂


with clj and even lein profiles, it would be nice if it would paste what the command was and let you add in profiles or aliases. which i'm assuming is what bruce needs


just quick edit the command in the minibuffer


But that is a step in the other direction - adding more knowledge about the build tools in CIDER.


As some point you could actually treat lein profile specially, but we removed this we added support for boot.


On one hand - that’s one of the simplest part of the codebase, but on the other hand the optimal choices are not really apparent.


Ops, I misread your message.


Yeah, that’s true. That’s where we have to go IMO.


Just a single string to which we append whatever we have to for the auto-injection to work.


yeah. or it can even be after the injection so we don't have to try to figure out where that has to go


clj tooling has made it dead simple to add aliases which alter class paths, add dependencies, etc. need to be able to react


FWIW due to this I’ve stopped using cider-jack-in and just start a cider-specific nRepl on the terminal, then connect. With tools.deps it’s trivial to inject the dependencies etc etc so I just added an alias that does just that. I guess I have to update that whenever CIDER updates, but that’s fine for now.


unfortunately order does matter here and I think in most cases folks want to use the behavior that you have but simply need to change the aliaes and such that comes before the -m nrepl


in the case of Clojure CLI


Yep, I agree.


Anyways, I think that’s some simple changes can yield solid usability improvements. We just need to decide in which direction we want to go.


you could even detect the if there is a last -m arg coming from the user and then make a decision from there


Hey! I am using clj and cljs in my project and facing a problem when evaluating code from files using cider-eval-last-sexp. Cider dont understand what file I am visiting and evaluates the code in the correct REPL, instead it's evaluated in the most recent REPL. This is often a problem as I jump back and forth between clj and cljs files. Can I easily fix this somehow?


what version of CIDER are you using. this sounds like a 0.17 problem


CIDER 0.19.0snapshot (package: 20181021.830)


When I use cider connect with a hostname it doesn't allow me to specify the port. It just tries to connect to hostname. If I type in hostname:port, it then asks me to add the port.


@jeremy642 Can you be more specific about this? Normally you’ll prompted for the host first and the port afterwards.


@U051BLM8F When I run cider connect, it ask for host. As soon as I type in the host, it tries to connect (Opening connection for host, waiting for prompts from remote shell message) to the host and does not ask for port.


Seems to me you’re using tramp and probably some ssh tunneling is happening automatically.


I can’t imagine any other reason why something like this can happen.


I'm not sure what tramp is. Anywhere I can look it up? SSH tunneling maybe. I have an ssh config for ssh username setting. I also am behind a corporate proxy which is known to cause problems.


So, you’re not trying to connect to a locally running nREPL, right?


I am trying to connect to a remote repl. I'm not even sure if it's possible to connect to it. I was just trying to get it to let me type in the port. If I type in the host incorrectly such as host:port in the host field, it then asks me for port. But if I just type the host in, it doesn't ask me for port.


There’s some config that we always try to tunnel remote connections via ssh for security reasons. Let me see where this setting was.


(defcustom nrepl-force-ssh-for-remote-hosts nil
  "If non-nil, do not attempt a direct connection for remote hosts."
  :type 'boolean
  :group 'nrepl)

(defcustom nrepl-use-ssh-fallback-for-remote-hosts nil
  "If non-nil, attempt to connect via ssh to remote hosts when unable to connect directly."
  :type 'boolean
  :group 'nrepl)


I see both are disabled, but maybe you’re on a different version.


I am on 0.18.0 snapshot of cider. You know, I never did try with IP instead of the host. I just tried that and it asked for the port and connected.


I have a CLJS app and I am running CIDER 0.19.0snapshot (package: 20181021.830). I think remember being able to call cider-find-var for thing at point and it would find the var declaration in my current namespace or in the some other namespace. Now cider-find-var will only find var if it belongs into another namespace. Is there something I need to change or configure to get back the old behaviour?


wow that is surprising. what does it say when the var is defined in the current ns?


and just to make sure, this isn't a let binding var, right (which has never been supported)


These are for defn and in the *Message* buffer it outputs user-error: Symbol 'thing' not resolved


I am putting together a fork of Emacs live but Clojure centric - it is here but this is very very early days and I don't think anything, including installing, works at the moment:

😍 1

Past Cider user here, currently on 0.18 and upgraded to use new piggieback and figwheel and can’t use both clj/cljs repls anymore (cljs works, clj doesn’t). In previous versions, I launched an nrepl with cider-jack-in, and started (start-figwheel!) and (cljs-repl) manually to work with clj, cljc, and cljs files. However with 0.18 version I can no longer use the clj repl after firing up cljs-repl. Here’s the error after evaluating a clojure form: “no clj repls in current session”. When i cider-jack in again (from clj file) to start a ‘sibling repl’ cider hangs and no repl is started. What has changed and how do you enable clj repl after starting cljs repl? Here’s project.clj

:plugins [[lein-figwheel "0.5.16"]
         [lein-cljsbuild "1.1.7" :exclusions [[org.clojure/clojure]]]]

  :clean-targets ^{:protect false} ["resources/public/js/compiled" "target" "test/js"]

  :cljsbuild {:builds [{:id "dev"
                        :source-paths ["src/cljs"]
                        :figwheel {:open-urls [""]}
                        :compiler {:main basic-component.core
                                   :asset-path "js/compiled/out"
                                   :output-to "resources/public/js/compiled/app.js"
                                   :output-dir "resources/public/js/compiled/out"
                                   :pretty-print false
                                   :preloads [devtools.preload]}}]}
  :profiles {:dev {:dependencies [[binaryage/devtools "0.9.9"]
                                       [cider/piggieback "0.3.10"]
                                       [figwheel-sidecar "0.5.16"]]
                   :source-paths ["src/cljs"]
                   :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}})