JSP syntax highlighting for IntelliJ

I just downloaded IntelliJ 15.0.1 Community Edition because I'm tired of Eclipse and it looks terrible on my laptop (Ubuntu 14.04 LTS). Everything went well until I saw that the syntax highlighting in the JSP files did not work.

I went to Settings / Editor / File Types

In the recognized file types, among other parameters, I have this:

JSP files (syntax highlighting only)

When I select it, I see in the registered templates: * .jsp, * .tag that exactly what I want ... but it does not work ... any ideas?

thanks

+7
java intellij-idea jsp
source share
3 answers

IntelliJ IDEA allows you to manually add syntax highlighting options to Settings> File Types, even in Community Edition , but it ignores these settings after a restart .

These settings are stored in the user's home directory, for example. ~ / .IdeaIC2016.1 / configuration / file types / *. XML Unfortunately, after rebooting the IDE, these settings are NOT readable, so it is useless to configure any settings: - (

<filetype binary="false" description="JSP files (syntax highlighting only)" name="JSP"> <highlighting> <options> <option name="LINE_COMMENT" value="" /> <option name="COMMENT_START" value="&lt;%--" /> <option name="COMMENT_END" value="--%&gt;" /> <option name="HEX_PREFIX" value="#" /> <option name="NUM_POSTFIXES" value="" /> <option name="HAS_BRACES" value="true" /> <option name="HAS_BRACKETS" value="true" /> <option name="HAS_PARENS" value="true" /> <option name="HAS_STRING_ESCAPES" value="true" /> </options> <keywords keywords="%&gt;;&lt;%!;&lt;%@;include;page;taglib" ignore_case="false" /> <keywords2 keywords="c:choose;c:if;c:otherwise;c:set;c:url;c:when;fmt:message;fmt:setBundle;fmt:setLocale;s:eval;s:message;sec:authorize" /> <keywords3 keywords="html;head;title;meta;header;nav;section;footer;body;a;br;hr;div;form;input;button;submit;textarea;p;script;noscript;span;style;table;td;th;tr;ol;ul;li;label;i;h1;h2;h3;h4;h5;img" /> <keywords4 keywords="if;else;function;for;do;let;this;while;with;thows;true;false;char;case;continue;alert;confirm;console;length;return;var;boolean;forms;" /> </highlighting> </filetype> 

(~ / .IdeaIC2016.1 / config / filetypes / JSP.xml)

IntelliJ Community Edition also ignores any file type options for CSS files, which might look like this:

 <filetype binary="false" description="CSS files (syntax highlighting only)" name="CSS"> <highlighting> <options> <option name="LINE_COMMENT" value="" /> <option name="COMMENT_START" value="/*" /> <option name="COMMENT_END" value="*/" /> <option name="HEX_PREFIX" value="#" /> <option name="NUM_POSTFIXES" value="" /> <option name="HAS_BRACES" value="true" /> </options> <keywords keywords="a;body;button;div;font;font-face;form;frame;h1;h2;h3;h4;iframe;img;import;input;li;link;media;nav;ol;option;p;select;span;table;td;th;title;tr;u;ul;video" ignore_case="false" /> <keywords2 keywords=" box-shadow;background;background-color;border;border-radius;bottom;box-shadow;color;content;cursor;display;float;font-family;font-size;font-weight;height;left;line-height;list-style-type;margin;margin-bottom;margin-left;margin-right;margin-top;outline;overflow;padding;padding-bottom;padding-left;padding-right;padding-top;position;right;text-align;text-decoration;text-transform;top;vertical-align;white-space;width;z-index;zoom" /> <keywords3 keywords="em;pt;px;rgb;rgba" /> <keywords4 keywords="!important;active;after;before;hover;none;visited" /> </highlighting> </filetype> 

(~ / .IdeaIC2016.1 / configuration / file types / CSS.xml)

+5
source share

IntelliJ supports JSP syntax highlighting, but, oddly enough, none of the syntax is predefined. This allows us to define the syntax, although if you double-click "JSP files (syntax highlighting only)".

The +/- buttons let you add keywords, and the 1/2/3/4 tabs give different syntax colors. It is not possible to add all the HTML / JSP keywords manually, but I have identified the most commonly used keywords, and this is much better than no highlighting at all.

Change file type

+3
source share

You must create your own JSP file type, for example. "My JSP." Registered file templates must be:

*. J R

*. J Pf

(*. jsp reserved)

In the standard file type: "JSP files (for syntax highlighting only)" you must delete the * .jsp file patterns. Install it, for example *.jjj .

Then IntelliJ Idea saves this type of file and after rebooting the settings are still available.

+2
source share

All Articles