Home Download Buy Blog Forum Support

Server Side Scripting - Nested Syntax Highlighting

Server Side Scripting - Nested Syntax Highlighting

Postby danield on Fri Jul 27, 2012 4:06 pm

I'm not sure if this is a problem with other server side scripting languages, but I code in ASP and if you ever nest ASP tags (<% %>) inside of any other script tag (like javascript) it trashes the syntax highlighting.

This is especially problematic if I have an ASP block inside of a javascript block and I use an ASP comment. Since syntax highlighting still treats the ASP like javascript, it takes that single quote (which is a comment in ASP) and treats it like the start of a string. The string coloring then wraps around each line until it hits another single quote somewhere in the file and so on and so forth screwing up the entire files syntax highlighting.

Since ASP is server-side its tags (<% %>) should always take precedence in syntax highlighting. This really needs to be fixed.

Copy and paste the below into a new file and set the syntax highlighting to ASP - HTML
Code: Select all
      <script type="text/javascript">
         jQuery('#loaded').change(function() {
            var example = <% aspVariable ' this is my asp variable %>
            if (jQuery(this).val() === 'SCH') {
               toggleOpt2('2305EF50974D4C34962F3170ADF72BA6', false);
            } else {
               toggleOpt2('', true);
Posts: 4
Joined: Tue Jul 03, 2012 5:51 pm

Re: Server Side Scripting - Nested Syntax Highlighting

Postby zeroCool on Sun Nov 22, 2015 4:17 pm

for the comment problem just fix the ASP.tmLanguage...
this line <string>(').*$\n?</string>
becomes this line <string>(')((?!%&gt;).)*</string>

for the nested syntax you will have to change more files...
Posts: 1
Joined: Sun Nov 22, 2015 4:01 pm

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 20 guests