This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-24
Channels
- # aleph (5)
- # announcements (18)
- # babashka (3)
- # babashka-sci-dev (56)
- # beginners (56)
- # biff (5)
- # calva (27)
- # cider (20)
- # clj-commons (2)
- # clj-kondo (17)
- # cljsrn (18)
- # clojure (41)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-serbia (1)
- # clojure-uk (15)
- # clojured (1)
- # clojurescript (40)
- # cursive (39)
- # datahike (2)
- # datalevin (4)
- # datascript (5)
- # emacs (23)
- # events (2)
- # figwheel-main (3)
- # inf-clojure (1)
- # instaparse (23)
- # introduce-yourself (3)
- # jobs (3)
- # jobs-discuss (13)
- # joyride (1)
- # juxt (10)
- # malli (21)
- # nbb (29)
- # off-topic (18)
- # pathom (29)
- # polylith (11)
- # project-updates (1)
- # proletarian (1)
- # rdf (2)
- # re-frame (4)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (52)
- # tools-deps (57)
- # xtdb (32)
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 bracketas 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
Is there any specific reason you are looking to achieve such a clojure-unorthodox style?
personal preference i guess
it's really difficult to get used to this formatting style coming from other languages
but also: if you have nested maps, the indentation can easily pushed off the side of the screen
nested data structures* - not specific to maps
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
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)
I suspect I'm not the only clojure user coming from C-syntax-style-languages that feels this way
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
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
what you can do to help you judge where forms start and end is set up the matching brace highlighting
already have that enabled
appreciate your help though
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
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
I found Cursive's keybinds good for the operations I mostly use, which are slurp, barf, raise and splice
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.
Have you tried doing this, checking the build
tool alias?
no, where is that?
Clojure Deps window. By default it should be in the upper right application margin.
ah, yep. I have that hidden by default. found it though. thanks I'll give that a try!
You'll need to hit the refresh icon in that plugin's toolbar after checking the alias.
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
)
oh, but a full restart of intellij fixed that. great! thanks again!
Does your build
alias in your deps file include the dep for io.github.seancorfield/build-clj
?
Ah. Cool. 👍
Not sure what you are using build.clj
for, but yesterday I tried https://github.com/liquidz/build.edn and it worked great.
Or slightly more officially: https://clojure.org/guides/tools_buildhttps://clojure.org/guides/tools_build:)
@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’s an IntelliJ thing.