I want to add completion with no annotations.

Hi.
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?

thanks!



Attachment(s):
PostsController.php_-_kihon_-____www_kihon_.png
15 comments
Comment actions Permalink

You need to implement your own CompletionContributor.

0
Comment actions Permalink

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?

thanks!

0
Comment actions Permalink

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 .

0
Comment actions Permalink

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?

thanks!

0
Comment actions Permalink

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.

0
Comment actions Permalink

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.



Attachment(s):
CakeStormCompletionContributor.java_-__cake-storm__-_cake-storm_-____Dropbox_100_Programming_java_cake-storm_.png
0
Comment actions Permalink

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.

0
Comment actions Permalink

Thank you for the information.

I tried them, but they do not appear in the auto popup.

Code is here.

https://gist.github.com/vexus2/7576143

"foo" and "bar" will be displayed in Basic Completion.
but, they do not appear in auto popup completion.

What do you think cause of?



Attachment(s):
全画面_2013_11_21_13_28-3.png
全画面_2013_11_21_13_30-2.png
0
Comment actions Permalink

Is your code invoked during autopopup completion: if you put a breakpoint there, does it stop?

0
Comment actions Permalink

It does not come in there when the auto popup.
But, it stops at the break point when run the Basic Completion.

0
Comment actions Permalink

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.

0
Comment actions Permalink

How do I stopped by a break point for the file of the jar?

0
Comment actions Permalink

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.

0
Comment actions Permalink

"stopHere" has been called by PhpCompletionContributor$PhpMemberRefCompletionProvider.
And, I could not debug because there is no source code of php.jar.



Attachment(s):
PhpCompletionContributor.class_-__php__-_cake-storm_-____Dropbox_100_Programming_java_cake-storm_.png
0
Comment actions Permalink

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

0

Please sign in to leave a comment.