Fix mixin autocomplete spinning indefinitely in classes with many lambdas#2596
Open
embeddedt wants to merge 1 commit intominecraft-dev:devfrom
Open
Fix mixin autocomplete spinning indefinitely in classes with many lambdas#2596embeddedt wants to merge 1 commit intominecraft-dev:devfrom
embeddedt wants to merge 1 commit intominecraft-dev:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In large classes with many lambdas (e.g. Minecraft 1.20.1
ChunkMap/Minecraft/etc) mixin autocomplete for filling inatof@Inject(at = "...")stops working. More precisely, from profiling and dumping thread states, it appears to get stuck doing a ton of Psi resolution work inhasSyntheticMethod.The cleanest approach I was able to find is to adjust the lambda counting code so that the indexes stored in
SourceCodeLocationInfocan be used without requiring the expensivehasSyntheticMethodcheck in the Psi visitor. This reduces the work done during visiting to just theMatcher's counting, which is not really super efficient either, but fast enough not to be an issue for interactive editing.hasSyntheticMethodis now unused, but I've left it in place for the time being since it's a utility method. (Happy to remove if desired.)Note: in the interest of full disclosure, the analysis for this problem was done in collaboration with an LLM. The fix appears straightforward and I have confirmed that it solves the problem. That said, the ASM/Psi analysis code here is quite complex and it's possible that changing the meaning of
lambdaCountas done here may have broken something inadvertently.