Fix frequent “Detecting Minecraft frameworks” with heavy system load.
Minecraft Development for IntelliJ plugin version
2025.1-1.8.4
Description of the feature request
When a project with more than 100 modules is open, “Detecting Minecraft frameworks” runs periodically, which puts a heavy load on the system. I would like this to happen either faster or to be cached somehow.
The framework detection happens whenever the project model changes, like adding/removing content roots or libraries. There might be a stacktrace printed in the logs every time this is the case.
Caching doesn't make sense, as detection reruns when something it depends on changes. I looked into making it faster a while ago and couldn't find a way to do it properly without potentially breaking things, not saying it's impossible though.
I would like to bump this.
We also have a very large project with over 100 modules. Detecting Minecraft Frameworks can take 10-15 minutes and it does this nearly every time we start our IDE's.
The main issue is that you can't do anything while this "background task" is running. It causes the UI to become incredibly lagging, to the point where sometimes it will just freeze for a while.
Possible solutions:
- Adding a file at the root which tells minecraft dev how to match modules based on path regex
- Implement caching which only gets reset when code within its module changes, not dependencies
- Optimize the code
- Remove the threading mess (so that the code is readable)
- Batch the Facet changes (to prevent the UI lagging out)
- Take into account modules being disposed
- Only run once Intellij is done processing all files
- The task may be running more than once, make it cancellable and cancel previous threads.
I haven't really looked at why its so slow, this is just from looking at the code.
@FxMorin is your large project in a public repo? It's tough to improve things without being able to test against a real example. If the code is private but you'd be willing to share it privately for testing we can do that too.
@DenWav Yes this is a private repo, and unfortunately I am unable to share it.