Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the class selected with the cursor for the Find Mixins action #103

Closed
wants to merge 1 commit into from
Closed

Use the class selected with the cursor for the Find Mixins action #103

wants to merge 1 commit into from

Conversation

stephan-gh
Copy link
Contributor

Assuming I have a Mixin class open in the editor:

@Mixin(Entity.class)
public abstract class MixinEntity {

}

When I right click the Entity.class part I'd expect the Find mixins action to search for other Mixins that target Entity and not for Mixins which target MixinEntity. With these changes it will attempt to resolve the selected reference before checking for mixins of the current class.

Since the changed method is also used in other contexts I'm not entirely sure if the change also breaks something else.

import com.intellij.psi.PsiMember
import com.intellij.psi.PsiModifier
import com.intellij.psi.PsiModifierListOwner
import com.intellij.psi.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No * imports.

import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.annotations.Contract
import java.util.Collections
import java.util.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No * imports.

@stephan-gh
Copy link
Contributor Author

@DemonWav Fixed

@DenWav
Copy link
Member

DenWav commented Dec 4, 2016

I'm not comfortable with this implementation, as getClassOfElement()'s purpose is specifically to get the class that contains the element, never the class of the element. I think this should be implemented in FindMixinsAction instead.

@stephan-gh
Copy link
Contributor Author

@DemonWav I've modified getClassOfElement to take an additional resolveReferences parameter which is false by default. Does that solve the issue?

@DenWav
Copy link
Member

DenWav commented Dec 5, 2016

@DenWav DenWav closed this Dec 5, 2016
@stephan-gh stephan-gh deleted the find-mixins-cursor branch December 13, 2016 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants