JS syntax highlighting in ASP?
-
Hello,
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
var
lines, maybe with different background color for bonus points. However only client-side<script>
block is highlighted according to JS rules.
Interestingly, changingLANGUAGE
from JScript to anything else produces VB highlighting, meaning it is taken into account, so maybe I’m just doing something wrong here? -
@John-Doge
when using JScript Language I do get both var colored.Notepad++ v6.9
Build time : Feb 21 2016 - 21:27:55
Admin mode : OFF
Local Conf mode : ON
OS : Windows 7Cheers
Claudia -
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. -
John,
yes, I selected JavaScript from the language menu, NOT asp or html.
If Scite works, then I assume it has to do with the different scintilla versions.
Npp does not use the latest scintilla library.Cheers
Claudia -
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.