Completion of attributes for default Grails tags doesn't work!?
Hi everybody.
I've installed ultimate version of IntelliJ 9.02 (30 days trial). I've been learning grails a few days now, and before Intellij, I tried SpringSource (poor support) and NetBeans 6.8 (way too slow). IntelliJ has best Grails support so far, but I've noticed that attribute code completion for gsp tags doesn't work. In eclipse, it was enough to put taglib reference into the page (<%@ taglib prefix="g" uri="/web-app/WEB-INF/tld/grails.tld" %>), and everything worked just fine. But when I tried to apply same method in IntelliJ, all gsp tags became red with hover messages like this: "Element g:createLinkTo is not allowed here".
Is this general issue with IntelliJ, or I screwed up something with my project setup?
Thanks for all the help!
请先登录再写评论。
Actually, the completion should work without this explicit taglib
import. Have you tried that?
Unfortunately, no. I only tried to add taglib reference after I saw that it doesn't work. ctrl+space only pops-up "No suggestions". My friend have installed 9.01 v on ubuntu, but has the same problem.
What did you try to complete?
For example, if I type "<g:", and then ctrl+space, code completion works just fine and every gsp tag is listed. But if I have "<g:each", ctrl+space doesn't give anything. Even if I start to type attribute name, for example v for "var" attribute in g:each, it still doesn't complete. It's interesting that completion works only for g:message tag ( "error", "code" and "default" attributes). Is there maybe some plugin that I forgot enable?
Now I see. For many tags, there's not enough knowledge about their
attributes (e.g. they're not mentioned in .tld), thereforee IDEA doesn't
complete the attributes. This will be dealt with:
http://youtrack.jetbrains.net/issue/IDEA-49581
BTW for many tags defined in ApplicationTagLib-like classes it helps to
have sources of those classes attached to the project. IDEA will scan
them and infer at least some attributes' existence.
I hope it'll be fixed with 9.03. So, there isn't workaround for now!?
Ether way, thanks for all the help!
I'm afraid it's not too probable. But we'll try!
For now, the only workaround I can imagine is to go to grails.tld and
write all the necessary information manually. But I can imagine it's not
that exciting task.
This issue will be fixed in the next 9.0.3 EAP.
Workaround: replace your %PROJECT%/web-app/WEB-INF/tld/grails.tld with the attached file
Attachment(s):
grails.tld.zip
Thanks for the help. Now most of the tags work just fine.
Would it make sense to contribute the .tld file to the Grails project?
Perhaps. I'll contact them, thanks for the idea!
One thing though. Although now attributes for most of the tags are displayed, there is still issue with some (while for example). I noticed for those that "required" is not setted. I tried to fill that up myself, but it didn't work. Anyway, better something, than nothing
This will be fixed in next EAP elso.