Fork me on GitHub
#cider
<
2018-10-21
>
theeternalpulse15:10:46

I have cider-auto-test mode running and am testing something that deals with namespaces, so in the test I set up a namespace before the test namespace and every time it loads it adds a (:require... statement to the topmost namespace, which isn't necessary. Even if I use in-ns it does this.

dpsutton15:10:49

It adds text to the ns form you mean?

theeternalpulse15:10:56

so i have

(in-ns 'top-level)
(defn...)
(defn...)

(ns my-proj.core-test
  (:require [my-project.core :as core]))

theeternalpulse15:10:16

and when I do something like core/ <--- insert slash and it does a lookup

theeternalpulse15:10:50

it throws a runtime error and does this

(in-ns 'top-level
  (:require [my-project.core :as core])
(defn...)
(defn...)

(ns my-proj.core-test
  (:require [my-project.core :as core]))

dpsutton15:10:05

This is almost certainly a bug in clj refactor. I think lots of tooling assume the first form of a file is the ns form

theeternalpulse15:10:27

maybe creating a temp namespace is not the proper way to do it, should it just go in it's own file?

theeternalpulse15:10:08

yeah, I figured it was the case. but I was thinking there was a variable that can control that behavior, or tell it to ignore in-ns forms

theeternalpulse15:10:13

maybe it's this

cider-test-infer-test-ns is a variable defined in ‘cider-test.el’.
Its value is ‘cider-test-default-test-ns-fn’

Documentation:
Function to infer the test namespace for NS.
The default implementation uses the simple Leiningen convention of appending
’-test’ to the namespace name.

theeternalpulse15:10:53

I'll just save the headache and do the one ns per file

dpsutton15:10:59

I doubt it is that

theeternalpulse15:10:30

right, I see my dummy ns doesn't end with -test

dpsutton15:10:35

It's clj refactor automatically adding a required ns. And also noticing that you lack a ns declaration (according to it's logic)

dpsutton15:10:43

(i'm guessing)

bozhidar15:10:21

Yeah, that’s true.

bozhidar15:10:16

It’s the only config that can result into an auto-added ns form to my knowledge.

bozhidar15:10:09

Generally much of the code in clojure-mode assumes a single ns form, so using in-ns is a recipe for problems.

bozhidar15:10:48

(although there’s also code that checks for the closes ns preceding the point)

theeternalpulse15:10:21

gotcha, I updated my test to avoid it

kingcode16:10:22

Is there a way to setup lein with-profile +cljs-dev figwheel from within my project file? I am trying to use core.matrix from clojurescript, following the instructions, but am running figwheel from within CIDER…Thanks for any advice..

dpsutton16:10:20

CIDER has defvars that you can set globally or override per project. here are the dir locals for my work project:

((nil . ((cider-lein-global-options . "with-profile dev")
         (cider-default-cljs-repl . figwheel))))

kingcode16:10:40

Thanks @dpsutton, will look at that..

kingcode16:10:50

@dpsutton Actually, I just found out from the shell prompt that cljs-dev profile doesn’t exist. I know this isn’t CIDER related…

dpsutton17:10:50

It looks like it's just cljs not cljs-dev

dpsutton17:10:16

Also bump the piggieback and figwheel versions.

dpsutton17:10:26

To the cider versions

kingcode18:10:01

@dpsutton ok thx…I restarted CIDER and it’s working now - probably just a hiccup

kingcode18:10:23

Still working with CIDER 15, need to upgrade…

mathpunk19:10:11

Is there a way to find unbalanced parentheses? Last night I was able to run new figwheel-main projects in cider, but now when I start a new project, I get an unmatched delimiter error, with no hint as to where to even look

mathpunk19:10:13

🤔 it seems like I can still use old-figwheel --- I don't need to do anything fancier than look at generated svg so this probably works for now

hlolli19:10:17

does someone know how to inject depdencency (and append it to pre-existing deps) with .dir-locals.el ?

hlolli19:10:35

I'm running Cider with tools.deps if that's a factor

dominicm19:10:18

@hlolli there's two parameters which matter with clojure, one of them pertains to "prefix" flags, put -Sdeps there. I think multiple -Sdeps merge.

hlolli19:10:24

@dominicm Do you know which cider variable defines the prefix flags on top of your head? I could theoretically as well append full path to a .jar to the java classpath?

dominicm19:10:55

@hlolli I don't, I just remember that there's two of them, I think they both start with clojure, one of them has parameters in the name.

hlolli19:10:26

ok thanks, I'll grep it out 😉

dominicm19:10:31

@hlolli I'm not sure what happens if you add a :path key with -Sdeps, never tried. But you could definitely do it if you gave it a coordinate.