JS syntax highlighting in ASP?
Is there a way to highlight server-side JS in .asp (ASP Classic) files? Given the testcase:
<%@ LANGUAGE="JScript" %> <% var x = 1; %> <script> var x = 1; </script>
The expected result would be similar highlighting in both
varlines, maybe with different background color for bonus points. However only client-side
<script>block is highlighted according to JS rules.
LANGUAGEfrom JScript to anything else produces VB highlighting, meaning it is taken into account, so maybe I’m just doing something wrong here?
when using JScript Language I do get both var colored.
Build time : Feb 21 2016 - 21:27:55
Admin mode : OFF
Local Conf mode : ON
OS : Windows 7
Thanks Claudia! This is strange however, because I have various NP++ versions up to 7.0 on multiple machines and haven’t seen it working anywhere.
Could you please clarify:
Did you have the file saved as .asp?
Did you change language via NP++ menu to anything other than ASP or HTML?
As a side note, highlighting works with
LANGUAGE="PHP"as well as VBScript, so it seems that only JScript is broken for me.
Also, everything works as expected in SciTE.
If Scite works, then I assume it has to do with the different scintilla versions.
Npp does not use the latest scintilla library.
Ah, that’s not how it’s supposed to work. HTML parser should detect language of embedded script blocks on its own without user changing the top-level language, because there are HTML/ASP tags that also need their own highlighting.
Thanks for the heads up, I think I’ve found the diff between np++ and scintilla code that’s responsible. I should probably take it to github from here.