Community
    • Login

    JS syntax highlighting in ASP?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 3.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • John DogeJ
      John Doge
      last edited by

      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, changing LANGUAGE from JScript to anything else produces VB highlighting, meaning it is taken into account, so maybe I’m just doing something wrong here?

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @John Doge
        last edited by

        @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 7

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 1
        • John DogeJ
          John Doge
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • John DogeJ
              John Doge
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors