I have some issues with the built in syntax highlighting for JSP pages in Sublime Text 2.
See the code after the white line on line 11/12: The HTML tag <strong> is displayed correctly here.
The code before this line is not correctly colored: The second JSP closing tag (%>) is in red, but should be in orange like the first one and the HTML tags inside are recognized as Java code I think, although the scopes (visible with CTRL+SHIFT+ALT+P as text.html.jsp) do not change.

If I do the same with <?php or <? starting and ?> closing tags the problem does not exist, all colors seem to be right then.
Did anyone have the same problem? I made sure that the syntax is set to JavaServerPages (JSP).
I think the problem relates to these lines in HTML.tmLanguage file (JSP scope is inside HTML scope):
<dict>
<key>embedded-code</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#ruby</string>
</dict>
<dict>
<key>include</key>
<string>#php</string>
</dict>
<!--
<dict>
<key>include</key>
<string>#smarty</string>
</dict>
-->
<dict>
<key>include</key>
<string>#python</string>
</dict>
</array>
</dict>
There is no include for JSP. But I'm only guessing... Any ideas?
I managed to edit the HTML.tmLanguage and Java Server Pages (JSP).tmLanguage files now... some matches for ruby overwrote the jsp scopes inside HTML <script> tags and I removed the match for curly brackets, and additionally I added some text.html.jsp includes to a few scope definitions.
I copied my .tmTheme file and put it into the User package folder as User.tmTheme. I then added these lines to this file at the bottom:
<dict>
<key>name</key>
<string>Embedded Code Punctuation</string>
<key>scope</key>
<string>punctuation.section.embedded</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#FD971F</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded Java Code Directive</string>
<key>scope</key>
<string>punctuation.section.directive</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#FD971F</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded Java Code</string>
<key>scope</key>
<string>source.java.embedded.html</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F8F8F2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded Java Code String</string>
<key>scope</key>
<string>string.quoted.double.java</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#E6DB74</string>
</dict>
</dict>
I then edited these two files in the folders HTML and Java and commented out some ruby includes and stuff.
See the files here:
HTML.tmLanguage
Java Server Pages (JSP).tmLanguage
JavaScript.tmLanguage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With