Fork me on GitHub
#cursive
<
2022-05-24
>
aratare03:05:35

is it just me or that new UI looks similar to vscode?

cfleming04:05:25

Yes, soon Cursive will look just like Calva!

calva 3
馃槀 3
chrisbroome12:05:12

Is there a way to tell cursive to format maps differently? What I'm looking for is instead of this:

(def my-map {
             :a 1
             :b 2
            })
I'd like this:
(def my-map {
  :a 1
  :b 2
})
So, 2 spaces indent relative to the previous indent instead of 1 space indent relative to the opening curly bracket

imre12:05:23

that's a rather java/script-y formatting style

imre12:05:08

as far as I know Cursive's indenter works in relation to the containing form (which in the case of the contents of the map would be the curly brackets themselves), not in relation to the previous indentation level

imre12:05:32

I believe most Clojure formatters work in this way

imre12:05:56

Is there any specific reason you are looking to achieve such a clojure-unorthodox style?

chrisbroome12:05:51

personal preference i guess

chrisbroome12:05:01

it's really difficult to get used to this formatting style coming from other languages

imre12:05:33

(def my-map
  {:a 1
   :b 2})

chrisbroome12:05:53

but also: if you have nested maps, the indentation can easily pushed off the side of the screen

chrisbroome12:05:09

nested data structures* - not specific to maps

imre12:05:29

(def my-map
  {:a 1
   :b 2
   :c
   {:foo 1
    :bar 2
    :baz
    {:qux 1
     :quux 2}}})

chrisbroome12:05:25

that's fine but not gonna lie - the 1 space relative to opening brace just kinda kills me. it makes it very hard to see where the nesting begins/ends

imre13:05:21

While I respect your preferences (I also have my own nits here and there) but I think I'd rather suggest that you familiarize yourself with the conventions that are more established in existing codebases, otherwise you might have a hard time reading others code and vice versa (and potentially collaborating with others)

chrisbroome13:05:23

I suspect I'm not the only clojure user coming from C-syntax-style-languages that feels this way

imre13:05:48

I don't know about any clojure editors that support the style you are trying to achieve so I'd imagine it could feel like pissing against the wind a bit

chrisbroome13:05:53

yeah... just feels like yet another hurdle to overcome for new Clojure users. but i do agree that if there's a standard I probably should familiarize myself with it

1
imre13:05:00

what you can do to help you judge where forms start and end is set up the matching brace highlighting

chrisbroome13:05:18

already have that enabled

chrisbroome13:05:23

appreciate your help though

imre13:05:49

Welcome to the community! I'm sorry I couldn't have better news. If you haven't so far, do also check out paredit/structural editing. Coming from C#, that was the feature that made me never want to go back to editing c-style code ever again

chrisbroome13:05:40

I use it in a very limited way right now. I love the power/capability, but I do need to learn all the keyboard shortcuts. Honestly Tony Kay's fulcro tutorials have been amazing for seeing what's possible in a "real world" setting using structural editing

imre13:05:12

I found Cursive's keybinds good for the operations I mostly use, which are slurp, barf, raise and splice

cap10morgan16:05:06

Is there a workaround for the build.clj is not under a source root issue w/ tools.build when build.clj is in the project root? Or is putting it in a subdir still the best one? Searched back through the channel history and cursive user guide a bit but didn't see anything.

R.A. Porter16:05:52

Have you tried doing this, checking the build tool alias?

cap10morgan16:05:01

no, where is that?

R.A. Porter16:05:29

Clojure Deps window. By default it should be in the upper right application margin.

cap10morgan16:05:28

ah, yep. I have that hidden by default. found it though. thanks I'll give that a try!

R.A. Porter16:05:31

You'll need to hit the refresh icon in that plugin's toolbar after checking the alias.

馃憤 1
cap10morgan16:05:25

hmm... that fixed the "not under source root" but it still can't resolve the library fns I'm calling from build.clj (e.g. b/uber)

cap10morgan16:05:27

oh, but a full restart of intellij fixed that. great! thanks again!

R.A. Porter16:05:28

Does your build alias in your deps file include the dep for io.github.seancorfield/build-clj?

R.A. Porter16:05:36

Ah. Cool. 馃憤

Ivar Refsdal18:05:02

Not sure what you are using build.clj for, but yesterday I tried https://github.com/liquidz/build.edn and it worked great.

cfleming21:05:18

@U06FS3DLH Yes, the initial indexing can be flakey after selecting that alias, generally just opening and closing the project (without a full restart) works. I think it鈥檚 an IntelliJ thing.