cursive

ericdallo 2025-04-11T14:15:57.687469Z

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 ?

ericdallo 2025-04-11T14:16:17.367439Z

I mean this option

cfleming 2025-04-11T22:17:32.059099Z

Yes. If you use Run with Leiningen it will pick it up.

cfleming 2025-04-12T03:45:51.847359Z

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.

cfleming 2025-04-12T03:46:13.426169Z

But you can't select different profiles for different run configs, unless you use Run with Leiningen.

ericdallo 2025-04-13T12:58:37.269959Z

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.

ericdallo 2025-04-13T12:59:09.322769Z

IMO cursive should check if the project is lein and consider that file for consistency

cfleming 2025-04-13T20:40:59.702099Z

If you're using lein and you want that, then just use the Run with Leiningen option.

ericdallo 2025-04-13T20:47:17.632379Z

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

cfleming 2025-04-13T20:48:53.841559Z

I just created a new lein project, and the REPL configuration which is created by default uses the Run with Leiningen option.

cfleming 2025-04-13T20:51:35.647489Z

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.

ericdallo 2025-04-13T20:54:50.199199Z

Thanks, that default should help, do you know if after your fix, existing run configurations will keep using the Intellij one?

cfleming 2025-04-13T21:00:17.486109Z

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.

cfleming 2025-04-13T21:01:33.837909Z

Frequently devs choose the IntelliJ classpath because of some craziness that a lein plugin does that Cursive can't support.

ericdallo 2025-04-13T21:01:41.983609Z

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

cfleming 2025-04-13T21:02:41.648919Z

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.

ericdallo 2025-04-13T21:05:23.248189Z

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

cfleming 2025-04-13T21:08:24.325689Z

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.

cfleming 2025-04-13T21:10:06.753429Z

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?

ericdallo 2025-04-13T21:10:50.722979Z

Yeah, lein sucks sometimes, I can see the problem all of that is

ericdallo 2025-04-13T21:11:08.464449Z

Yes, all other editors rely on lein repl

ericdallo 2025-04-13T21:11:14.209409Z

Me included

ericdallo 2025-04-13T21:11:49.358739Z

But alright, thanks for the explanation and default fiz,that should help in long term

cfleming 2025-04-13T21:12:14.566439Z

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.

cfleming 2025-04-13T21:12:50.521219Z

And yes, the profiles management in lein is bonkers.

cfleming 2025-04-13T21:13:29.647079Z

Integrating lein was the single hardest thing I did in Cursive.

ericdallo 2025-04-13T21:14:06.184289Z

Yeah, I can see, mine is understand Intellij SDK haha I have a question related to that:

ericdallo 2025-04-13T21:14:24.858879Z

Will start a new thread for that one