Custom Code Completion plugin (for XDoclet). Need API help.


I'm thinking about writing an XDoclet plugin for IDEA that uses code completion for @tags. (There is already an XDoclet GUI plugin for IDEA in XDoclet's CVS, but it's a bit different, since it uses a tree-view and is not integrated with the IDEA editor).

With this plugin it should be possible to start typing a @tag (note the caret):


  • @ejb.|


-and this should pop up all valid tags in the @ejb namespace, e.g.

-Sort of like when methods pop up for a variable.

I'm completely new to the Open API, and would appreciate som hints about what classes/interfaces I should use to implement such code-completion behaviour. I have the data - just need to hook this behaviour up to IDEA's editor.

Aslak - The XDoclet team.


If I can attempt to clarify what it is Aslak is asking for - is there a way to capture the code completion event? Or register a handler that can handle code completion in comments?



(Aslak pasted this from a mail from Niclas)

Try this Aslak,

Options | IDE Settings | Errors | Unknown javadoc tags | Additional
javadoc tags

Put this in ...


Now it should work as you want... it's been there almost from first



Thanks Niklas,

I had no idea this was possible. -And it's funny, in the settings box IDEA uses XDoclet tags as example :)

But I was actually thinking of something more elaborate. It's ok to get tags popped up, but this functionality is dumb. It does not consider whether a tag is class- or code-level. Nor does it hide/show relevant tags according to the context. (I don't want to see @ejb tags when I'm coding a Struts action).

And the most important thing (which I didn't detail enough in my IDEA forum post): I also want the tag attributes to pop up when I have written the @tag.

All this requires more fancy logic -> a custom plugin.

So my question is: Does the Open API allow this?



This works, but it cant give you the rest of the arguments that are associated with that particular javadoc tag. How would one go about doing this?



Err. I should have finished the thread before I posted. My point was already made! Sorry...