Fork me on GitHub
#cursive
<
2023-09-21
>
isak21:09:44

Is it normal to keep your project .iml checked in? It seems like it should be to keep goto definition working properly. Just wondering if it breaks down in practice?

R.A. Porter21:09:01

No. Editor files should not be included in source control. That was a bad, bad habit that Eclipse devs were notorious for. Editor metafiles like .iml and the whole of the .idea directory should be excluded in .gitignore (or the equivalent for other VCS). Iff this is today and tomorrow and for all time a one-person repo, then it’s your choice, obviously. Might be nice to share between different machines, I guess.

🙏 1
cfleming23:09:03

Actually, JetBrains’ guidance on this is a bit more nuanced, see: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839. In that doc it talks about Gradle or Maven projects, you can mentally substitute deps or lein projects there since they work in the same way. I would recommend not sharing .iml files or libraries since they’re regenerated on project sync, as they discuss there.

🙏 1
R.A. Porter23:09:20

I get their nuance, but very few modern libraries and apps (and really none written in Clojure) don't provide build/dependency support separate from anyone's tooling. Too often when editor tooling gets into a project, contributors are forced to use those tools. I haven't seen that in a while, fortunately, but it was quite prevalent in the aughts. "Just install Eclipse and..." Best not to let projects be corrupted that way from the beginning.

cfleming00:09:39

There are things stored in the .idea folder that are useful to share, and won’t corrupt the project. e.g. project run configurations, project symbol resolution customisations, etc.

💡 1
👍 1
isak21:09:26

It seems like the deps integration is destroying my project .iml file. It is removing directories I have manually right clicked on and marked as source roots. Is there a way to turn that behavior off?

cfleming23:09:53

Yes, the idea there is that the source roots in the project should reflect what the project file is doing. Is there a reason you need to manually mark sources, rather than using e.g. :paths?

cfleming23:09:13

The Gradle and Maven integrations work in the same way, BTW.

isak23:09:40

Oh I see. I have an external little java project for generating java source for using protbuf / GRPC bindings.

isak23:09:17

Therefore I added the output generated java sources so that goto definition would work.

isak23:09:48

Also, what do we for script directories that are in fact marked as source dirs in some aliases?

cfleming23:09:57

Ok, in that case what you could do is have a :generated alias including that dir in :extra-paths, and then select that alias in the toolwindow like this: https://cursive-ide.com/userguide/deps.html#working-with-aliases

isak23:09:54

Got it, will give that a try. I think then I understand how it is supposed to work. Thanks!

cfleming23:09:27

I’m not sure what you mean by the script directories, you mean that they’re in :extra-paths in an alias and you’d like them marked as source roots?

isak23:09:15

Yea, and I thought they were being removed. But it also may have been that I had the wrong aliases checked when I imported the project.

cfleming23:09:56

Ok, you can always just check them in the toolwindow and refresh the project, they should be added then.

isak23:09:52

Ok I see that working now, thanks for clarifying.

👍 1