Try this simple live template:

  <template description="Tag pair (in Java comments)" name="&gt;&gt;"
shortcut="TAB" toReformat="true" toShortenFQNames="false"
value="&lt;$TAG_NAME$&gt;$END$&lt;/$TAG_NAME$&gt;">
    <variable alwaysStopAt="true" defaultValue=""
expression="&quot;tag&quot;" name="TAG_NAME" />
    <context>
      <option name="JAVA_CODE" value="false" />
      <option name="JAVA_COMMENT" value="true" />
      <option name="JAVA_STRING" value="true" />
      <option name="XML" value="false" />
      <option name="HTML" value="false" />
      <option name="JSP" value="false" />
      <option name="COMPLETION" value="false" />
      <option name="OTHER" value="false" />
    </context>
  </template>


It is active in java comments (javadoc and/or end-of-line comments) and java
strings.  Just type in >> (two greater than signs) and hit TAB -- it will
expand to this:

<tag></tag>

with the first "tag" highlighted, changing as you type.  If I type
"template" and hit enter, this is what I see:

<template>|</template>

with the cursor in the middle, waiting for me.


Granted this only works well for the new code you type, not existing strings
-- for that, yes a surround with option would be handy.


BTW: the reason I used ">>" as the trigger for this live template is that
IDEA comes with a live template to do EXACTLY the same thing.  It is only
enabled for HTML/XML, by default.  It uses just one "<" (less-than sign) as
the trigger so that hides the trigger I wanted to use "<<".

-sms


-----Original Message-----
From: Juan Pablo Casares [mailto:[EMAIL PROTECTED]]
Sent: Tue, April 02, 2002 4:05 PM
To: [EMAIL PROTECTED]
Subject: [Eap-features] "Surround with <code>" for Javadocs


I would find very useful to have "Surround with" functionality in Javadocs.
In particular, to quickly add <code> tags.
This kind of functionality could be easily extended/customized.

Actually, IDEA could detect which word should have the <code> tags and add
them automatically. Even better, IDEA could
figure out which is the best documentation so I don't need to write it....

Thanks,
    -Juan


-------------------------------------------------- 
DISCLAIMER 
This e-mail, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information.  If you are not the intended recipient of this
e-mail, you are hereby notified that any dissemination, distribution or
copying of this e-mail, and any attachments thereto, is strictly prohibited.
If you have received this e-mail in error, please immediately notify me and
permanently delete the original and any copy of any e-mail and any printout
thereof. 

E-mail transmission cannot be guaranteed to be secure or error-free.  The
sender therefore does not accept liability for any errors or omissions in
the contents of this message which arise as a result of e-mail transmission.

NOTICE REGARDING PRIVACY AND CONFIDENTIALITY 

Knight Trading Group may, at its discretion, monitor and review the content
of all e-mail communications. 


_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

Reply via email to