Make IntelliJ 11 treat aui:script the same as script
Hey All,
I feel like this should be so simple, but it's eluding me!
I'm trying to make:
<aui:script use="xxx,yyy,zzz">
function a() {
alert('test');
}
</aui:script>
highlight and self indent EXACTLY like:
<script>
function a() {
alert('test');
}
</script>
I tried duplicating the script part in the language injections settings in 11.1 ultimate, and adding aui as a prefix but it didn't work.
Is there any way to do this?
Thanks!!
Please sign in to leave a comment.
bump
bump?
Hello.
What is the definition of "aui" namespace prefix? Do I need some library to download?
Thank you,
Alexander.
I never saw that you replied to this, I'm terribly sorry for the extreme delay.
You can see the taglib here: https://github.com/liferay/liferay-portal/blob/master/util-taglib/src/META-INF/aui.tld
You can see the actual code, here: https://github.com/liferay/liferay-portal/tree/master/util-taglib/src/com/liferay/taglib/aui
You can see where the script tag gets injected, here: https://github.com/liferay/liferay-portal/blob/master/util-taglib/src/com/liferay/taglib/aui/ScriptTag.java around line 202 as of this posting.
Hello.
The file where you're trying to get proper script element: is it jsp or html (or anything)?
Thank you,
Alexander.
Usually JSP files is where I'd try it, occasionally a JSPF
I've managed to get proper highlighting inside aui:script in a jsp file the following way:
1. Added liferay's util-taglib.jar to the module's depenencies.
2. In the jsp file provided the declaration of aui prefix (mapped to http://alloy.liferay.com/tld/aui).
3. In Settings / Language Injections copied xml:script element (it's bundled, find it) and in the properties of the copy set http://alloy.liferay.com/tld/aui namespace.
Please try.
Regards,
Alexander.
Trying now!!! *HOPE*
Didn't work :( If it matters, I'm on IJ 12 now.




Here are screenshots
This is the file I tested:
(I also tried <%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %>)
Here is the file after reformatting code:
You can see it's lost all indenting, and the colors aren't right.
Here is my language injections:
and my module settings:
Your code sample refers to http://liferay.com/tld/aui, while the injection settings refers to http://alloy.liferay.com/tld/aui. Make them the same, please.
Alexander.
Fixed, I had fixed it before and did upload the right screenshot. Here is the correct screenshot.


I also made a youtube video of it, which you can see HERE: http://www.youtube.com/watch?v=ERbtvExFhCU
Given your screenshot, it does not look that Javascript language
injection took place (JavaScript plugin should be enabled btw)
On 2/6/2013 7:53 AM, Brett Swaim wrote:
>
>
>
>
>
Did you see my youtube video, here: http://www.youtube.com/watch?v=ERbtvExFhCU
What part of the injection did I do incorrectly?
Providing the plugin is enabled (please, re-check it), and injection is configured, I have no idea, why it can't work. For me it does.
Can you try new small test project? If it does not work for it too, could you attach it?
Thank you,
Alexander.
when you say make sure the plugin is enabled, do you mean this?

EDIT:

After some playing, I see that the cause is: var uri = "<%=ajaxUrl%>?cache=" + new Date().getTime();
if I remove that, everything formats perfectly. I look forward to your thoughts!
Original:
Progress!! It code highlights now!! So good!
Okay, the last problem is that it's still not indenting. Try this, in your project paste:
<aui:script use="aui-io-request,aui-parse-content">
var form = A.one('.question-display-container');
form.plug(A.Plugin.ParseContent);
var uri = "<%=ajaxUrl%>?cache=" + new Date().getTime();
var request = A.io.request(uri, {
on: {
success: function () {
var indicator = A.one('#loading-indicator');
if (indicator) {
indicator.remove();
}
A.all('.aui-widget.aui-component.aui-rating.aui-thumbrating').remove();
form.setContent(this.get('responseData'));
setTimeout(function () {
request.start();
}, 1500);
}
}
});
</aui:script>
and
<script>
var form = A.one('.question-display-container');
form.plug(A.Plugin.ParseContent);
var uri = "<%=ajaxUrl%>?cache=" + new Date().getTime();
var request = A.io.request(uri, {
on: {
success: function () {
var indicator = A.one('#loading-indicator');
if (indicator) {
indicator.remove();
}
A.all('.aui-widget.aui-component.aui-rating.aui-thumbrating').remove();
form.setContent(this.get('responseData'));
setTimeout(function () {
request.start();
}, 1500);
}
}
});
</script>
Do they format the same?
This is what I see:
Thank you for your patience.
The formatting is really a problem. I've created this one: http://youtrack.jetbrains.com/issue/IDEA-100870
Please watch and comment.
Alexander.
I have managed to inject javascript for <aui:script> tags as explained in this discussion.
However, after weeks of use with no issue (other than the formating issue), I have lost my injections, and reinserting them doesn't work.
I assume my injection settings have been somehow corrupted. Can somebody tell me how to reset the custom injections ?
Thanks and best regards,
Alain
As a first step, please recheck Settings / Language Injections.
Regards,
Alexander.