Fork me on GitHub
#cursive
<
2020-01-28
>
Vincent Cantin09:01:19

@cfleming I found a subtle bug in Cursive: the param b is shadowed by the function name. A runtime test shows that the opposite is in fact happening.

cfleming09:01:46

That is definitely subtle! Could you file an issue for that please?

cfleming09:01:09

Yes, it’s in the header of the Cursive channel.

mbjarland10:01:33

Hi all, is there any way in cursive to get case expressions to align properly? Known issue?

simongray12:01:27

You can change the default indentation to “2 spaces” by clicking on the small lightbulb that appears when you put the cursor around (`case`

simongray12:01:44

No way to get vertically aligned kvs afaik though

mbjarland12:01:35

right, my issue isn’t really the number of spaces but the fact that (:a :b) doesn’t align with (:d :e) etc in my example.

mbjarland12:01:57

I use “reformat code” extensively which essentially disqualifies the use of case for me…can’t stomach looking at that indentation : )

mbjarland12:01:25

ok, solved, with either “indent” or “function” setting for case they do align:

(defn equ
  [a]
  (case a
    (:a b) true
    :c true
    (:d :e) true
    false))
I’m happy and apologies for not finding this sooner

simongray12:01:17

great that you managed to solve it 🙂

simongray12:01:26

An alternative is to use map lookups instead of a case statement. That way you can also get vertical alignment.

mbjarland05:01:21

@U4P4NREBY how would you do branches with multiple elements in them with map lookups?

mbjarland05:01:58

I did this with:

(condp get a
  #{:a :b} true
  #{:c} false
....
which kinda works but has extra noise in there

Joe R. Smith12:01:22

Why doesn't code completion work for things def'd in comment forms?

cfleming21:01:50

Because it’s a bit tricky, basically. You’d only want the completion to work within the comment block, not in normal code, and that’s somewhat complicated. That said, it’s possible - if you could file an issue for that I’ll take a look at it.

stijn13:01:16

in the editor color settings, is there a way to color the top level symbols for Clojure (defn foo [a] (bar :x)), coloring foo but not bar? It's not there in the clojure specific settings

cfleming21:01:28

So a specific colour for vars, basically? Or for var definitions?

stijn12:01:52

For var definitions

stijn13:01:26

I guess inheriting from Language Defaults > Identifiers > Function declaration or Global variable could work? But yes, I would like to only make it highlight at the definition site, not the usage

cfleming22:01:06

That’s a good idea about inheriting the style. I’ll check whether that’s doable/easy.

stijn07:01:31

Ok, that would be really nice, thanks!

stijn07:02:32

And one other thing, would it be possible to make a difference between line comments (with ;) and form comments (with comment or #_)? Line comments usually provide important info and would like to highlight that, but commented forms can be greyed out. For some background, I'm trying to implement https://github.com/tonsky/intellij-alabaster in a dark scheme

maxt15:01:58

Is there a solution for turning of namespace maps? Running (set! *print-namespace-maps* false) in user.clj gives me

java.lang.IllegalStateException: Can't change/establish root binding of: *print-namespace-maps* with set

cfleming21:01:12

No, unfortunately. I’m planning to have an init section in REPL run configs, containing commands to be run after the REPL is initialised. That would fix this case and others.

maxt15:01:23

Found some mentions of the problem but no solutions

maxt15:01:07

A hook when cursive is started would be great

Alex Miller (Clojure team)15:01:23

user.clj is read too early

Alex Miller (Clojure team)15:01:36

the repl binding for *print-namespace-maps* hasn't been set yet

maxt16:01:06

Right, I realize that's the problem. It's unfortunate, since I can't find any hook that is run later.

maxt16:01:33

Overriding print-method like suggested here https://groups.google.com/forum/#!topic/clojure/XAP0ENMSUTc does work.

maxt16:01:33

But it feels a little rough. A post-repl init hook would be nice.

imre16:01:11

The case is similar if you want to (set! *warn-on-reflection* true) in user.clj for example, won't work

madstap20:01:15

Sometimes cursive seems to indent maps like this:

{[: :]
                      {,,,}

 [: :]
                      {,,,}}
which I'd expect to be indented like:
{[: :]
 {,,,}

 [: :]
 {,,,}}
Is there a setting for this?

cfleming21:01:22

No, that looks like a bug to me. Could you file an issue with a reproduction case?

madstap21:01:53

Yeah, I'll do it tomorrow as it's a coworker and not me.