Fork me on GitHub
#cursive
<
2020-02-24
>
roklenarcic16:02:06

is there a way to have cursive sort all the map keys in an edn file alphabetically?

cfleming08:02:26

No, there’s nothing like this at the moment.

roklenarcic08:02:40

It would be a neat feature because when editing large edn files it can be easier to find things if they are sorted alphabetically. I know it doesn’t impact the actual generated datastructure.

Alex Miller (Clojure team)16:02:06

maps are unordered, so don't expect that doing so will have any impact on what happens when you read/compare.

kulminaator16:02:33

if you throw it's contents into a treemap then this one is sorted

kulminaator16:02:28

but it's a bad idea to build things based on sorted maps, i have only used it for comparison of deep json trees in tests

imre16:02:52

I have a suspicion that the reason in this case is code style/ease of reading/nicer diffs

imre16:02:22

like when you order requires in your ns form

kenny17:02:54

Cursive seems to get confused by an exception I'm throwing

Error printing return value (ExceptionInfo) at compute.data-model.spec-helpers/add2 (spec_helpers.cljc:240).
asd
Expanding the stacktrace shows:
clojure.lang.ExceptionInfo: null #:clojure.error{:phase :print-eval-result}
	at clojure.main$repl$read_eval_print__9086.invoke(main.clj:442)
clojure.lang.ExceptionInfo: compute.data-model.spec-helpers/add2 threw an exception. {:sym compute.data-model.spec-helpers/add2, :spec #object[clojure.spec.alpha$fspec_impl$reify__2524 0x73f4d05a "clojure.spec.alpha$fspec_impl$reify__2524@73f4d05a"]}
	at compute.data_model.spec_helpers$cleanup_check_result.invokeStatic(spec_helpers.cljc:224)
clojure.lang.ExceptionInfo: asd {}

cfleming08:02:48

I’m struggling to follow this - is your exception the asd one?

kenny15:02:06

Haha understandable. I threw an ex-info that had an ex-info as the cause.

kenny15:02:24

So both are "mine"

jumpnbrownweasel17:02:07

The problems I was having with slowness/unresponsiveness in recent versions of IntelliJ are a little better after increasing the heap size. I got a low memory warning. The slowness was discussed in an earlier thread here that's now gone. I do have a lot of workspaces open at a time, but it's also possible that recent versions are using more memory. FWIW you can increase heap size with the Heap->Change Memory Settings menu item.

kenny19:02:43

When switching to a particular branch, the entire IntelliJ UI freezes. It appears to have something to do with reading projects.

kenny22:02:20

Why does switching branches require Cursive to re-read all the projects? It seems like it should have cached that from the last time I switched to a branch.

cfleming08:02:51

I think so, yes. It should only re-read those which have changed, and I’m not sure why the UI should freeze.

kenny15:02:54

It would happen quite consistently on both my Mac and Linux computers.

kenny21:02:41

It is definitely not caching the "read projects" between branches.

cfleming21:02:07

Ok. What I’m going to do is add some debug logging to the caching to help diagnose this. That should be in the next build.

4