Fork me on GitHub
#cider
<
2018-12-10
>
theeternalpulse02:12:48

Is there a way to make the stack trace more consice when using cider eval preferably filter out/collapse parts of the stack that are not in the src folder or show only a summary?

dpsutton03:12:20

Check out the "project only" button or hit "p"

truemped09:12:58

Hi, already asked in #beginners and re-posting here: I have a problem with CIDER and reloading namespaces. I can run the application once but as soon as I reload CIDER complains that it cannot find a certain namespace. I've been reading "Reloading Woes" (https://lambdaisland.com/blog/09-02-2018-reloading-woes) and trying to find out the problem but to no help. Does anyone have a hint at the source of the problem?

alexyakushev11:12:23

Does CIDER have an ability to highlight compilation errors in the code buffer? I see some references to this in the issues, but I don't think it ever worked for me.

bozhidar13:12:18

That’s one of the oldest features and it always worked for me. 😄

alexyakushev13:12:58

Alright, maybe it's Boot-related. This should work by default, right?

alexyakushev13:12:18

Could you hint at the Emacs function I should debug?

bozhidar13:12:17

Try cider-extract-error-info in cider-eval.el.

bozhidar13:12:43

Basically we just parse the exceptions that happen after eval, extract the location info for the error from them and highlight the offending line.

bozhidar13:12:20

I think this was the very first commit I made to CIDER. 😄 (nrepl.el at the time)

alexyakushev13:12:11

Interesting. I was wrong that it doesn't work for me at all – e.g. reflection warnings are underlined yellow in the buffer. But I don't think I've ever seen red underlines.

alexyakushev13:12:39

It looks like on compilation errors (failed to compile) Emacs never enters cider-extract-error-info but it does on warnings.

dpsutton14:12:34

I've observed that in the past and I don't understand how it can happen

dpsutton14:12:07

On startup though

plexus14:12:13

I also haven't seen red underlines in a long time, IIRC I just get an exception buffer pop up when compilation fails

alexyakushev16:12:00

Do you use Leiningen or something else?

plexus16:12:59

mostly tools.deps (clojure cli) these days

alexyakushev14:12:19

Interesting! I restarted the REPL, and it looks like each new stacktrace op message adds another pprint-fn, print-length, and print-level.

alexyakushev14:12:02

However, that doesn't seem to be related to the error highlight problem.

bozhidar15:12:12

@dpsutton noticed this problem a while ago. I never had time to debug it, but it seemed like something harmless. It’s unrelated to what you’re experiencing.

pablore15:12:57

can someone tell me what does this error mean?

Could not start nREPL server: WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by mranderson048.orchard.v0v3v0.dynapath.v0v2v5.dynapath.defaults$eval3309$fn__3310 to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of mranderson048.orchard.v0v3v0.dynapath.v0v2v5.dynapath.defaults$eval3309$fn__3310
This happens after doing cider-jack-in. Also when doing lein repl on my terminal the process fails and this is printed:
REPL server launch timed out.

plexus15:12:02

you're running on Java 10 or 11 right?

pablore15:12:22

java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

plexus15:12:51

(one minute, I'm on a call)

pablore15:12:09

no prob 😉

bozhidar15:12:24

The warnings are not the problem, it must be something else.

bozhidar15:12:50

Take a closer look at your log, I assume there’s no more info there.

pablore15:12:02

yeah, the repl its timing out for some reason. Is there a way I can debug lein repl?

plexus15:12:53

is there anything in the *nrepl-server* buffer?

dpsutton15:12:40

if lein repl fails i don't think there is any hope of CIDER starting your project.

plexus15:12:50

you can also go to *Messages* and find the command that CIDER uses to launch nrepl, then run that in the terminal

dpsutton15:12:41

this sounds like a problem with your project, not CIDER. if you can't get a repl up with lein repl this isn't some bug that CIDER introduces

plexus15:12:55

> the repl its timing out for some reason maybe it's loading a namespace that blocks for some reason? do you have a user.clj?

pablore16:12:10

yep, it was an infinite loop i had in a file

dpsutton16:12:47

@truemped did you figure out your issue?

truemped16:12:52

@dpsutton No, unfortunately not. @cfeckardt gave me some feedback but in theory everything looks fine. I checked further and in the reply I see that c.t.n.r/refresh lists the namespace but somehow does not seem to find it.

dpsutton16:12:07

ah. so does this seem to be an issue with your project outside of CIDER?

truemped16:12:43

I'm really not sure. I do think it must be on my side (it usually is...) but I don't see the one thing that is wrong.

dpsutton17:12:10

from a blank repl can you require each namespace individually?

truemped17:12:44

I'm on my way home. Will try later. What is interesting is that initially it works. Only after I run either c.t.n.r/refresh or (cider-refresh) things don't work anymore

truemped20:12:51

Hm, so yes, I cannot require the namespace even on a freshly started repl session.

dpsutton20:12:49

what's up with the namespace. can you figure out a repro of this issue that others can see?

truemped20:12:46

I'll copy the repo into a private Gitlab one.

truemped21:12:31

You don't happen to have a Gitlab account?

dpsutton21:12:09

i sure don't

dpsutton21:12:31

but i also don't have time to clone your project. can you poke around the forms and see which ones are preventing your namespace from loading?

truemped21:12:17

so, let me copy what I have

truemped21:12:54

this is the error I see: clojure.lang.Compiler$CompilerException: java.lang.Exception: No namespace: felicity-lemon.config, compiling:(felicity_lemon/joining_streams.clj:1:1)

truemped21:12:33

this is the ns declaration in joining_streams.clj:

truemped21:12:35

(ns felicity-lemon.joining-streams
  (:require [taoensso.timbre :as log]

            [metrics.meters :refer (meter mark!)]
            [metrics.gauges :refer (gauge-fn)]

            [jackdaw.streams :as j]
            [jackdaw.serdes.json :as jsj]

            [felicity-lemon.config :refer (config)]
            [felicity-lemon.kafka-streams.metrics]
            [felicity-lemon.kafka-streams.serde])

  (:import (felicity_lemon.kafka_streams.serde JsonSerde)
           (felicity_lemon.kafka_streams.metrics MetricsBridge)
           (org.apache.kafka.streams KafkaStreams)
           (org.apache.kafka.streams KafkaStreams$StateListener)
           (org.apache.kafka.streams KafkaStreams$State)
           (org.apache.kafka.common.serialization Serde Serdes)))

dpsutton21:12:36

ok. can you find the felicity-lemon/config.clj file and try eval'ing it and see what happens

dpsutton21:12:05

is this clojurescript by any chance?

truemped21:12:05

... starting a repl

truemped21:12:35

config.clj:

truemped21:12:38

(ns felicity-lemon.config
  (:require
   [taoensso.timbre :refer (info merge-config!)]
   [cprop.core :as cprop]
   [cprop.source :as cp-src]
   [mount.core :refer (defstate)]
   [clojure.string :as str]
   [metrics.core :refer (new-registry)]

   [clojure.spec.alpha :as spec]
   [felicity-lemon.specs :as cs]))

dpsutton21:12:42

ok. well the error message is saying it doesn't know what felicity-lemon.config is. so start there

dpsutton21:12:57

can you eval that file?

truemped21:12:36

what do you mean by "eval that file"? I'm in the repl and have all stuff loaded. I can run (start) and it starts my API with felicity-lemon.config evaluated and running

dpsutton21:12:28

and you're sure that config is required and loaded when you evaluate (start)?

truemped21:12:52

yes, it adapts the configuration, i.e. listens on a different port depending on the config, e.g.

truemped21:12:07

only when I reload ...

truemped21:12:53

felicity-lemon.repl> (start)
18-12-10 21:22:32 daniels INFO [felicity-lemon.core:42] - Starting server on port 8080
{:started ["#'felicity-lemon.config/config-merges" "#'felicity-lemon.config/config" "#'felicity-lemon.core/mgmt-server" "#'felicity-lemon.config/joiners"]}

dpsutton21:12:22

nothing stands out to me sorry

truemped21:12:18

thank you anyways. Once I found the issue, this will be a very big aha! for me 🙂

petr18:12:43

Hey all. I'm trying to have cider work with deps.edn and I'm having trouble evaluating anything except simple forms such as (+ 1 2). Is the current workflow to create a new alias for your dev? If so. I'm having trouble determining which dependencies to include. It also seems that opening a repl in my terminal doesn't necessarily open a port along with it for cider to connect to?

lilactown18:12:53

@petr are you using aliases in your app's deps.edn?

petr18:12:46

I am. I also have some defined inside my .clojure/deps.edn. Are we able to specify which profiles to load from cider, or do we need to start the repl from teh terminal?

lilactown18:12:46

as in, in order to start your app for development it needs to run with a certain alias to include paths/deps/etc.

petr18:12:11

:nrepl {:extra-deps {nrepl {:mvn/version "RELEASE"}}
          :main-opts ["-e" "(require,'[nrepl.server,:refer,[start-server]]),(start-server,:port,60606)"]}
^^ Stolen from sean's gh

lilactown18:12:42

if you're using cider-jack-in, you can specify different params to the command by pressing C-u before the cider-jack-in

lilactown18:12:24

it should come up with an nREPL server command prompt which you can add e.g. -A:dev to

lilactown18:12:55

cider-jack-in will add all of the nREPL dependencies and start the server like you have in the alias, though, so you shouldn't need that

lilactown18:12:07

in a lot of my deps.edn projects now, I add a .dir-locals.el file to configure the way cider starts my app's REPL: https://github.com/Lokeh/lilac.town/blob/master/.dir-locals.el

lilactown18:12:05

in that project, I have dependencies and source paths defined in both a :server alias and a :dev alias that I want to include when I jack in

petr18:12:18

This is great, thank you