This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-25
Channels
- # announcements (1)
- # babashka (3)
- # beginners (48)
- # calva (1)
- # clj-kondo (1)
- # cljs-dev (6)
- # clojure (29)
- # clojure-europe (15)
- # clojure-spec (1)
- # clojure-uk (8)
- # clojurescript (17)
- # conjure (23)
- # css (7)
- # cursive (16)
- # datascript (1)
- # emacs (4)
- # fulcro (32)
- # hoplon (3)
- # keechma (16)
- # leiningen (1)
- # luminus (1)
- # meander (11)
- # off-topic (18)
- # pathom (15)
- # re-frame (12)
- # reagent (12)
- # reitit (5)
- # reveal (5)
- # spacemacs (5)
- # xtdb (18)
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. Hmm, interesting, looks like Clojure prioritises the parameter and Cursive prioritises the local fn name.
Yeah, that’s what I figured, too.
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._
Pardon the formatting; I'm on mobile, and can't find the option to turn off the newish "smart" formatting in Slack.
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.
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.
Is it possible for me to configure this in Cursive?
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.
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.
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.
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.
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.
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.
yes @U0567Q30W that was the case