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
Add method override autocompletion for Groovy Plugin #239
Conversation
This was created as a separate plugin in https://plugins.jetbrains.com/plugin/7571, but it fits better inside the official Groovy plugin.
Have you submitted a contributor license agreement? If not, please download the PDF from http://www.jetbrains.org/display/IJOS/Contributor+Agreement and then print it out, sign (mention you github account name there), scan and email to contribute@jetbrains.com |
I got accepted as a contributor this morning. Thank you. |
Agreement received. Thanks. |
Hi Jorge! |
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) { | ||
PsiElement position = parameters.getPosition(); | ||
|
||
if(psiElement() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to check psiElement().inside(PsiClass.class)
since we search for containing class and check if it is not null on the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done because otherwise you could get override or implement suggestions while inside a method definition, which I don't think really make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
psiElement.inside(PsiClass.class)
is fully equivalent to PsiTreeUtil.getParentOfType(position, PsiClass.class) != null
. Right now completion inside method body suggests overriding variants.
The correct place to put the pattern is register
method where currently you provide PlatformPatterns.psiElement(PsiElement.class)
. See a describing comment there
Don't worry about tests. Not a big deal actually. I'll write one or two examples to guarantee the feature won't be broken in future. |
Sorry for the delay. We will accept your commit in a few day. Thanks! |
That's really nice to know! I have a question, though: if I wanted this to be included on the next version of Android Studio should I add another PR to the 135 branch? Thank you 👍 |
If you want we can try to cherry-pick this to 135. But are you sure Android Studio uses the 135 branch? |
It is, as far as I know. The about me dialog shows 135 as build number and this answer in SO seems to support that. |
Hi, is there any way I can help to make this PR merge? It's been almost a month since the last update. |
Merged manually with updates. |
This was created as a separate plugin in https://plugins.jetbrains.com/plugin/7571,
but it fits better inside the official Groovy plugin.