I want to add completion with no annotations. Follow
You did a code completion of the class when you fill in the @property annotation.
I do not want to write the "@annotation", but I want the same thing in plugin.
Will there a way to accomplish this?
and, Is there a plugin that would be helpful?
Please sign in to leave a comment.
You need to implement your own CompletionContributor.
Hi Roman. Thank you for your response.
I have interpreted that "ComplectionContributo" needs to trigger "Ctrl+Space".
My perception wrong?
I do not want to enter "Ctrl + Space".
I want to suggest automatically immediately after the "$this->".
Is it can be realized with CompletionContributor?
You can implement your own TypedHandler and in checkAutoPopup method analyze the context (i.e. you're in a PhpFile, and just typed '>' after '-'), and invoke AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null); and return STOP. This should invoke autopopup completion .
Hi Peter. thank you for your response!
I understand that you handle the auto-popup by TypedHandler.
By the way, what is the list that appears in autoPopupMemberLookup?
Is this CompletionContributor?
If so, what is the ElementPattern?
The list consists of the items you provide in the CompletionContributor. ElementPattern is an implementation detail in your completion contributor that you may choose to use for checking for the correct completion context. TypedHandler just invokes the completion.
Thank you for your response!
What kind of ElementPattern should i set?
I tried in a pattern like a screenshot, but they do not work properly.
Do you mean the pattern commented out? It looks like correct one, if "->" is a single token in PHP. I'd suggest to override "fillCompletionVariants" method in CompletionContributor and check the PsiElement that's passed to it. Maybe consider writing if statements in that method instead of registering completion providers per patterns.
Thank you for the information.
I tried them, but they do not appear in the auto popup.
Code is here.
"foo" and "bar" will be displayed in Basic Completion.
but, they do not appear in auto popup completion.
What do you think cause of?
Is your code invoked during autopopup completion: if you put a breakpoint there, does it stop?
It does not come in there when the auto popup.
But, it stops at the break point when run the Basic Completion.
Then, there seems to be another completion contributor before yours that stops the process. You can put a breakpoint to com.intellij.codeInsight.completion.impl.CompletionServiceImpl.CompletionResultSetImpl#stopHere to see what it is. Note that stopHere calls from runRemainingContributors are completely OK, only explicit stopHere calls from the contributors are suspicious.
How do I stopped by a break point for the file of the jar?
Please attach sources for this jar (taken from IntelliJ IDEA Community Edition released at the same time, http://www.jetbrains.org/display/IJOS/Download) and put a breakpoint there.
"stopHere" has been called by PhpCompletionContributor$PhpMemberRefCompletionProvider.
And, I could not debug because there is no source code of php.jar.
Thanks. The solution for your contributor would be to be executed before PhpCompletionContributor. For this, just add order="first" to the completion.contributor tag in plugin.xml