Fork me on GitHub
#cursive
<
2019-10-22
>
vikeri05:10:50

@sogaiu very possible, I didn't do a fresh install of Catalina though, so fish is still my standard shell.

jumar07:10:55

Env vars on Mac OS X are just a huge mess. As alex said your "bash" env is completely ignored when apps are run

jumar07:10:08

I face this often when dealing with JAVA_HOME

jumar07:10:28

And things have changed a lot during the past releases of Mac OS X.

jumar07:10:35

I now use jenv exclusively to maintain JAVA_HOME properly; for other stuff I don't care as much but in case you need it you have to mess with .plist files (hard to say which one is the best)

vikeri08:10:02

It’s strange though because it works on my colleagues machine with Catalina and it used to work for me before catalina…

flowthing08:10:03

Just curious, is there a way to make e.g. clojure.pprint/pprint use the Cursive pretty-printer?

cfleming08:10:33

@flowthing There isn’t, but I’m planning on allowing pretty printing via Cursive from the REPL via an injected function, something like cursive.repl/pprint or something.

❤️ 1
flowthing08:10:51

Cool, thanks!

cfleming08:10:32

I’d also like to support diffing data structures in the Cursive GUI and other nice things.

2
flowthing08:10:29

That would be fantastic. :thumbsup:

onetom12:10:54

i would use diffing all the time, but nowadays even the idea diff does not work https://www.jetbrains.com/help/idea/command-line-differences-viewer.html

onetom12:10:50

for now i've resorted to using a bunch of different libraries and a few util functions to concisely inspect intermediary results while building data pipelines and testing them against production data with tens or hundreds of thousand elements.

onetom12:10:22

These are the most useful libs:

(ns repl
  (:require
    [gini.utils :refer :all]

    [clojure.set :as set]
    [clojure.data :as data]
    [clojure.string :as str]
    
    [debux.core :refer :all]
    [clansi :refer :all]
    [puget.printer :as pug :refer [cprint]]
    [clojure.pprint :as pp :refer [print-table]]
    [zprint.core :as z]
    [lambdaisland.deep-diff :as ddiff]
    [semantic-csv.core :as scsv])
  (:import [lambdaisland.deep_diff.diff Mismatch]))

👍 1
onetom12:10:41

this is a deep-diff printer with color customisations which make it readable in the cursive repl on a light theme:

(defn print-ddiff
  ([ddiff] (print-ddiff 80 ddiff))
  ([width ddiff]
   (->> {:width width}
        ddiff/printer
        (ddiff/pretty-print ddiff)
        (pug/with-options
          {:color-scheme {:number [:blue]
                          :string [:underline :black]}}))))

onetom12:10:16

use as

(print-ddiff
  (ddiff/diff
    {:a 132 :B {:c "asd" x: 'y}}
    {:a 999 :bb {x: 'z} :extra "data"}))

onetom13:10:40

The other thing I use often is this little sequence sampler fn:

(defn ?? [n] (juxt count (partial take n)))
(def ? (?? 4))
and in combination with clojure.data/diff for example:
(->> [big-seq-1 big-seq-2]
   (map set)
   (apply data/diff)
   (take 2) ; if we don't care about the common elements
   (map ?))
it's very useful, until cursive's pretty printer won't limit the dimensions of the printed expression evaluation results

onetom13:10:39

(the ansi escapes are garbled sometimes though, but it's usable enough, so i haven't bothered with finding a minimal repro case yet)

flowthing08:10:18

Also, I got to thinking a while back about whether it would be possible tap> values and have them appear in the Cursive GUI. Something like a built-in clojure.inspector (or mini-REBL).

cfleming08:10:18

Yes, once I have the REPL-to-IDE channel established it should allow all sorts of nice things along those lines, similar to a REBL in the Cursive GUI.

flowthing08:10:27

I don't want to take up much of your time with this, but I'm kinda curious about the approach you've considered for the REPL-to-IDE channel. I toyed with the idea of creating something like that myself, but I wasn't sure how to accomplish just that. My first thought was establishing a pREPL server at the IDE end and sending data that way, but I'm not sure whether that would be a viable option.

cfleming09:10:40

What I’m planning is for REPL protocols using framing (nREPL, and what Cursive’s new socket REPL uses, would work for prepl too), I can send messages back as part of an evaluation.

cfleming09:10:16

So the commands like pprint and diff will just send messages back to the IDE over the standard REPL channel. The challenge is that the mechanism for doing that is REPL specific.

cfleming09:10:05

prepl already has something like this - the REPL client will receive messages from tap>

cfleming09:10:28

But that’s hard-coded in the prepl impl.

flowthing09:10:23

Gotcha, makes sense. :thumbsup:

flowthing08:10:09

Awesome! Very glad to hear it. Something like that would be really helpful for debugging, especially combined with the data structure diffing capability you mentioned.

demus10:10:20

Hi! Can I start a lumo repl from Cursive? or just connect to a started one?

demus12:10:28

I works 🎉 thanks!

cfleming23:10:13

For those users who have reported problems with dependency completion (@tap, @dazld and others), it does appear to be extremely funky in IntelliJ 2019.2 and 2019.3. I must have tried to reproduce on 2019.1, my apologies. I’m going to contact JetBrains to figure out what’s going on.

👍 4
tap02:10:31

Updated to eap7. Do I have to do anything to provide useful data to the debug logging you added?

cfleming07:10:40

No thanks - I’ve actually figured out the problem (or at least, reproduced and diagnosed it): https://youtrack.jetbrains.com/issue/IDEA-225412

cfleming07:10:42

So now I’m just waiting on JetBrains to get back to me.

cfleming07:10:12

eap7 contains no changes for this in the end. Assuming they can help me out hopefully eap8 will contain fixes.