Fork me on GitHub
#cursive
<
2019-09-02
>
mike_ananev11:09:21

@cfleming Just installed new dev version. Everything looks good.

cfleming12:09:29

@mike1452 Oh great, thanks for letting me know.

p-himik13:09:15

Now that https://youtrack.jetbrains.com/issue/IDEA-91607 is closed, what would be the best way to move forward? Maybe a new issue with some Cursive-specific details?

p-himik07:09:54

@cfleming Do you have any thoughts on this?

cfleming09:09:03

Sure, similar to that issue, if you file issues for specific problems I’ll look at them. Depending on what they are, I may or may not be able to fix them though.

p-himik10:09:07

As I mentioned in the next to last comment on that issue - you've mentioned before that you have no control over the order of orderEntry tags.

cfleming20:09:44

Right, that one I don’t think I can control.

p-himik06:09:42

"So it looks like this problem is caused by code in Cursive plugin which adds entries to com.intellij.openapi.roots.ModifiableRootModel in different order"

cfleming20:09:43

@U2FRKM4TW I actually don’t think that’s correct since I’m using their internal API to do that, but no matter because the new deps integration will be out shortly and I can control these things there. I’ve asked for some clarification on that issue.

p-himik03:09:29

Awesome, thanks!

dazld14:09:41

what’s the project.iml file that appears after some actions?

dazld14:09:56

I thought idea kept all the config in the .idea folder

dazld14:09:08

wondering if it’s something that should be checked in, or it should be ignored

kenny15:09:04

@cfleming I have a large multi-module project. I tried updating to that dev build. IntelliJ did the usual restart thing and started loading. It's been stuck at about 75% loading for a solid 5 mins. When I mouse over the IntelliJ loading splash screen, the mouse is the spinner wheel. Will let it sit there for a while to see if it's just slow at resolving this big project.

kenny15:09:34

Gotta head out for a while. It's still loading, guessing it's not going to finish.

kenny17:09:05

Doing force quit and opening IntelliJ again let me get past the splash screen.

kenny17:09:35

It's now stuck on "Reading projects" for ~8 mins.

kenny17:09:16

Looks like it finished after ~15 mins. Perhaps this is caveat #2 where it refreshes every module?

kenny17:09:02

Received this exception after refreshing deps. It'd be great if it could tell me which project this is coming from.

Alex Miller (Clojure team)18:09:24

clj -Stree should tell you

Alex Miller (Clojure team)18:09:41

that should exist though, so might be a clojars issue

kenny18:09:48

Right but I'm working in a large multi-module repo (20+ libs). Cursive simply reported that error with no info about which project that came from.

kenny18:09:10

Another thing with the Clojure Deps REPL. When using "Run with Deps", can Cursive use the .cpcache files? It acts like it needs to calculate the classpath every time I open a REPL.

Alex Miller (Clojure team)18:09:28

it should, but I don't know what Cursive does

cfleming23:09:20

I can’t easily use the .cpcache because I’d have to reproduce everything that the script does in Java/Clojure/Kotlin.

cfleming23:09:42

I did look at that, but I couldn’t find a Java implementation of the hashing command used (cksum).

cfleming23:09:37

And I can’t just invoke the script because I can’t get everything I need from the various script commands (I can’t remember off the top of my head what was missing).

kenny00:09:11

@cfleming can you shell out to cksum from Java to use it?

cfleming00:09:16

Maybe. It’s still very brittle though, the script has a lot of non-trivial logic in it. If I reproduce it all, it’s very tied to a particular version of the script.

cfleming00:09:52

One thing I can do is just use a similar mechanism, but not try to use the same .cpcache that deps does.

cfleming00:09:19

One thing though, that bit hasn’t changed in this version, it worked the same way in the previous integration (in fact, that code didn’t change at all).

kenny00:09:32

Some sort of workaround would be a big win here. REPL restarts can take 30s or more due to the cp calculation. Sounds like the solution is either 1) add the necessary commands to the clj script 2) implement a Cursive specific cache

cfleming00:09:42

@kenny Did the REPL startup take that long previously?

cfleming00:09:57

i.e. with the old deps integration?

kenny01:09:14

Part of it has to do with S3 being slow, I think. Alex made it a bit better with the most recent release.

kenny01:09:13

I remember timing it and Cursive seemed to be about 3-5s slower than resolving via the CLI. This project just takes a while to calculate though. Having to calculate it each repl start even though nothing changed is painful.

cfleming01:09:29

Ok, just trying to figure out if that’s a regression or not.

kenny01:09:10

Don’t think so.

Alex Miller (Clojure team)04:09:49

cksum is not at all important, was just picked b/c it's fast, easy, and ubiquitous. you could totally hash it however you like and store it in cpcache anyways

cfleming08:09:45

Then the Cursive caching and the command line caching would stomp each other. I’ll just store the cached version for Cursive elsewhere.

cfleming08:09:13

The only implementation of cksum I could find in Java is GPL.

cfleming08:09:33

But caching it independently is a better idea anyway.

Alex Miller (Clojure team)12:09:02

You could use a known prefix or something to separate the cursive files in the cache dir

4
onetom15:09:22

I would vote for shelling out too, just to minimize the differences in behaviour between cursive and the cli tools.

onetom15:09:54

I just worked on some mobile app reverse engineering recently, so I had to deal with unknown protobuf structures as binary data, so I just wrapped xxd and protoc --decode_raw into functions:

(defn encode [data] (shell/run "xxd" "-g1" :in data))
(defn decode [data] (shell/run "xxd" "-r" "-g1" :in data :out-enc :bytes))

(defn protoc->raw [pb] (shell/run "protoc" "--decode_raw" :in pb))

onetom15:09:57

where shell/run is just a little error handling and direnv support on top of clojure.java.shell/sh:

(defn run
  "Use `direnv exec` to ensure the `.envrc` & `shell.nix` environments are available"
  [& args]
  (let [cwd (.getCanonicalPath (io/file "."))
        {:keys [out err exit] :as res} (apply sh "direnv" "exec" cwd args)]
    (if-not (zero? exit)
      (-> (str "Error running `" args "`\n" out err)
          (ex-info res)
          throw)
      (if (string? out)
        (str/trim-newline out)
        out))))

onetom15:09:04

it's so bad that direnv support is missing from intellij... makes it a lot harder to use nix under macos 😞

kenny15:09:14

I also wish IntelliJ supported direnv!

cfleming20:09:02

IntelliJ (and specifically Cursive) does support https://github.com/ashald/EnvFile, is that useful?

cfleming20:09:12

(I don’t know exactly what direnv does)

Matthew Davidson (kingmob)21:09:50

It’s a similar idea, but not as extensive. Nor does it work with all direnv setups, if I’m reading it correctly.

kenny21:09:38

Yeah. I looked at EnvFile when Cursive added support for it. EnvFile doesn't quite check all the boxes that direnv does.

kenny18:09:25

Yep. Just some feedback from Colin 🙂 Yeah, not sure what's going on with that artifact. Could be a bug in this dev build.

Alex Miller (Clojure team)18:09:28

but clojars has had some weirdness this weekend

caleb.macdonaldblack22:09:04

Can I create my own stubs?

cfleming23:09:45

@kenny I think there must be something else going on there, I have users using 80+ module projects with lein and (although it’s not especially pleasant) it does work ok.

kenny00:09:48

Don’t know either. I’m on a fairly recent MBP so I wouldn’t expect it to be hardware related.

cfleming23:09:59

This bit from the exception is weird: nodename nor servname provided, or not known

cfleming23:09:34

Googling that message a bit, it looks like that’s a DNS issue. Perhaps clojars was having issues.