Velocity generating Java

I'm starting a project where I generate both Java code and XML using Velocity.  IDEA seems to assume my velocity templates are generating HTML, which provides awesome support for the one HTML file I'm generating.  Is there any way to tell IDEA that some of my files are XML and others are Java?  I still want to keep the velocity validation & highlighting as well.

0
Avatar
Permanently deleted user

Sure - see File -> Settings -> Template Data Languages

-- Chat about IDEA in freenode channel #idea-users: http://webchat.freenode.net/


On 31.08.2010 22:07, Bryan Young wrote:

I'm starting a project where I generate both Java code and XML using Velocity.  IDEA seems to assume my velocity templates are generating HTML, which provides awesome support for the one HTML file I'm generating.  Is there any way to tell IDEA that some of my files are XML and others are Java?  I still want to keep the velocity validation&  highlighting as well.

>

---
Original message URL: http://devnet.jetbrains.net/message/5271448#5271448


0
Avatar
Permanently deleted user

Thanks.  I had just found this documentation and was renaming all my files to have both vm and a type in their extensions:
http://blogs.jetbrains.com/idea/tag/velocity/
The solution you provided was much better.

So far I'm very impressed with this.  After I turned everything on, I get completion for both velocity and my target language.  It was a little strange when my Spring inspections started showing errors in my velocity templates (of course they aren't valid bean names yet! it's just a template!).  I ended up disabling those inspections on this project.  

Thanks

0
Avatar
Permanently deleted user

wow.  turns out you can click on the inspector and turn off XML inspections (including spring) separately from the velocity inspections.  Very cool.

0

请先登录再写评论。