Fork me on GitHub
#cider
<
2018-10-23
>
dsiegel00:10:55

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?

dpsutton00:10:52

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

dsiegel00:10:01

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?

dpsutton01:10:20

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

dsiegel02:10:20

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.

dsiegel02:10:08

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.

dpsutton02:10:34

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

dsiegel03:10:48

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.

dsiegel03:10:41

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.

bozhidar09:10:01

@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.

bhauman12:10:21

how do I set the clojure cmd alias flags again?

bhauman12:10:42

I have to jot this down somewhere.

bhauman12:10:40

cider-clojure-cli-global-options

dpsutton12:10:30

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

bozhidar12:10:06

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

bozhidar12:10:35

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

bozhidar12:10:57

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

bozhidar12:10:21

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

dpsutton12:10:39

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

dpsutton12:10:51

just quick edit the command in the minibuffer

bozhidar12:10:16

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

bozhidar12:10:39

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

bozhidar12:10:29

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.

bozhidar12:10:06

Ops, I misread your message.

bozhidar12:10:18

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

bozhidar13:10:21

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

dpsutton13:10:32

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

dpsutton13:10:11

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

orestis13:10:54

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.

bhauman13:10:45

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

bhauman13:10:20

in the case of Clojure CLI

bozhidar13:10:19

Yep, I agree.

bozhidar13:10:43

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.

bhauman14:10:19

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

jherrlin17:10:48

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?

dpsutton17:10:58

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

jherrlin17:10:01

CIDER 0.19.0snapshot (package: 20181021.830)

jeremy64218:10:10

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.

bozhidar21:10:16

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

jeremy64215:10:56

@ 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.

bozhidar15:10:53

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

bozhidar15:10:04

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

jeremy64215:10:24

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.

bozhidar15:10:44

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

jeremy64215:10:10

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.

bozhidar16:10:48

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

bozhidar16:10:33

(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)

bozhidar16:10:59

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

jeremy64216:10:59

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.

emoarmy21:10:47

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?

dpsutton22:10:48

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

dpsutton22:10:13

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

emoarmy22:10:32

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

richiardiandrea22:10:33

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: https://github.com/arichiardi/clojure-live

pri23:10:27

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]}}})
Thanks!