Fork me on GitHub
#cursive
<
2020-07-25
>
reefersleep09:07:17

In Cursive,

(fn x [x]
  x)

marks the parameter x as unused, even though (x 10) ;;=> 10. I know that this is a weird example, but I just thought I'd bring it up.

cfleming23:07:19

Hmm, interesting, looks like Clojure prioritises the parameter and Cursive prioritises the local fn name.

reefersleep19:07:04

Yeah, that’s what I figured, too.

reefersleep09:07:24

Different issue, but related: is it possible for m to show parameters named either or _somename as unused? Clj-kondo complains that unused parameters should be named either underscore or be preceded by an underscore, and I get why; the source code, undecorated by syntax highlighting, will be more explicit about usage. And I agree with that reasoning; you don't always have syntax highlighting available._

reefersleep09:07:16

Pardon the formatting; I'm on mobile, and can't find the option to turn off the newish "smart" formatting in Slack.

reefersleep09:07:41

On to the point; underscore alone is a convention I'm used to seeing, but sometimes it's nice to give contextual hints by using a name preceded by an underscore, and this is new to me. And I am finding it much harder to ignore such a name.

reefersleep09:07:45

If Cursive were to gray out the underscored name, I'd find it much more agreeable; the underscored name would give you both a contextual clue and mark it explicitly as unused in a nonhighlighted context, and in Cursive, I'd be able to scan past it as I'm used to.

reefersleep10:07:04

Is it possible for me to configure this in Cursive?

cfleming23:07:09

Interesting, Cursive basically does the exact opposite of what you describe: the leading underscore basically means “don’t mark this as unused, because I know it is”. This is because marking something as unused is considered a light warning, and things like IntelliJ’s “jump to next error/problem” will pick it up.

reefersleep19:07:17

I totally get that, @U0567Q30W, it’s reasonable behaviour. I realise that it’s a case of me wanting to have my cake and eat it too; I want to mark symbols in the source as explicitly unused with a leading _, but I also want Cursive to colorize them differently in order for me to more easily scan the code.

reefersleep19:07:21

I figure that IntelliJ is so featureful that it might be able to do what I want through some (to me) obscure setting - or you might already have thought of this in Cursive somehow.

genRaiy10:07:29

Setting up IntelliJ in Linux without Clojure, cursive downloads 1.9. I had to uninstall Cursive, install 1.10.1 manually. Reinstall cursive and all good again.

onetom15:07:27

when would cursive download clojure? are you talking about loading a leiningen project or something? im curious, because i was also just setting up a pop!_os + nix machine a few hours ago and experienced some strange error when it was trying to generate stubs.

cfleming23:07:37

I’m curious about this too, the only time I can think of that Cursive downloads Clojure is when setting up a bare project with no dependency management.

genRaiy19:07:48

yes @U0567Q30W that was the case

genRaiy10:07:03

Maybe it’s just a dusty corner :)