is it true that if I run a Local lein REPL configuration using Intellij project classpath (which I think it's the default), it will ignore ~/.lein/profiles.clj ?
I mean this option
Yes. If you use Run with Leiningen it will pick it up.
Actually, thinking about it it's slightly more complicated than that. It depends on what you mean by "ignore". Profiles define extra paths, deps etc, and whether those are synced to IntelliJ is determined by how you've configured Cursive, see: https://cursive-ide.com/userguide/leiningen.html#working-with-profiles. If the profiles you're interested in are synced to Cursive, then they will take effect when you run that REPL.
But you can't select different profiles for different run configs, unless you use Run with Leiningen.
lein supports checking for ~/.lein/profiles.clj , we use that at Nubank to configure and inject middlewares in lein for all devs and repls, but it seems that cursive way using intellij classpath doesn't work with that.
IMO cursive should check if the project is lein and consider that file for consistency
If you're using lein and you want that, then just use the Run with Leiningen option.
I know, the problem is how I can tell to 1000 developers to change manually their repl run configuration to use what we thought it was suppose to work by default like all other editors, it's not easy. Cursive following lein and other editors standard would help Nubank so much
I just created a new lein project, and the REPL configuration which is created by default uses the Run with Leiningen option.
If I manually create one, it does look like it defaults to using the IntelliJ classpath, I'll fix that to default to Run with Leiningen if the module selected is a lein one. But the run with IntelliJ option will never support lein profiles, that's what the other option is for and sometimes you need one option or the other.
Thanks, that default should help, do you know if after your fix, existing run configurations will keep using the Intellij one?
I don't want to make a change which will magically cause a (pretty significant) change in the way existing REPL configs work for every lein developer out there.
Frequently devs choose the IntelliJ classpath because of some craziness that a lein plugin does that Cursive can't support.
Yeah, I'd say that the ideal would be have a flag to use or not the lein src profile, and the default be yes, which is what other editors and lein does
But that would change how all existing lein run configs work. I know that's what you want to happen, but I'm not going to do that because the effects would be massive.
I don't think it's that common to have a global lein profile, and if for some reason there is, I bet people would expect cursive to be using that, it was kind of a surprise for us to know cursive was the only one ignoring it. I'd see that as not a breaking change, but like a fix
The problem is that the way the REPL is run is completely different. The IntelliJ run config just uses information that IntelliJ already has synced, and doesn't call into lein at all. To use that profiles file, I have to call into lein to get the run config information, and then that is doing exactly what the Run with Leiningen option does. I'm happy to fix the defaulting for new run configs, since I think that makes sense. But retroactively changing how existing REPLs work is too large of an impact.
The problem is that it's impossible to isolate just the global lein profile from the rest of the leiningen machinery. It's basically all or nothing - do you use lein to run the REPL, or not?
Yeah, lein sucks sometimes, I can see the problem all of that is
Yes, all other editors rely on lein repl
Me included
But alright, thanks for the explanation and default fiz,that should help in long term
No worries, I'll try to get that in the next build, but I may not have time since the new IntelliJ version is imminent.
And yes, the profiles management in lein is bonkers.
Integrating lein was the single hardest thing I did in Cursive.
Yeah, I can see, mine is understand Intellij SDK haha I have a question related to that:
Will start a new thread for that one