Home > computers > Add RegExp and CommentDoc Highlighting for JS to Programmer’s Notepad

Add RegExp and CommentDoc Highlighting for JS to Programmer’s Notepad

July 13th, 2011 Leave a comment

    For a couple of days now I’ve been using Programmer’s Notepad instead of Notepad++. It’s smaller, it’s faster, and its memory footprint is roughly one third of Notepad++. Yes, there are fewer plug-ins available and it’s not getting updated as often as its more famous competitor but guess what – it has everything I need. Today I tried to create a scheme for JavaScript syntax highlighting that appeals to me. It was very easy and there are only a few very small bugs to iron out.

    Anyway, I wasn’t able to style CommentDoc keywords and regular expressions. As usual, Google came to the rescue. After doing some research I found that I had to manually edit the cpp.scheme file in the schemes directory of Programmer’s Notepad. Look for the following part and add the highlighted lines to your file:

    <language base="cppbase" name="javascript" title="JavaScript" folding="true" foldcomments="true" foldelse="true" foldcompact="true">
      <comments line="//" streamStart="/*" streamEnd="*/" blockStart="/**" blockLine=" *" blockEnd=" */" />
      <use-keywords>
        <keyword key="0" name="Keywords" class="javascript"/>
        <keyword key="1" name="Keywords 2" class="jsunsure"/>
        <keyword key="2" name="CommentDoc Keywords" class="commentdockw"/>
      </use-keywords>
      <use-styles>
        <style name="Doc Comments" key="3" class="commentdoc"/>
        <style name="Keywords 2" key="16" fore="b00040"/>
        <style name="Comment Doc Keyword" key="17" fore="3060a0"/>
        <style name="Unknown Comment Doc Keyword" key="18" fore="804020"/>
        <style name="RegEx" key="14" fore="3f7f3f" back="e0f0ff" eolfilled="true"/>
      </use-styles>
    </language>
    

    Now we only have to create the commentdockkw class we added in the code above (simply add the highlighted lines to your cpp.scheme at the appropriate position):

      ...
      <keyword-class name="jsunsure">
        undefined
      </keyword-class>
      <keyword-class name="commentdockw">
        <!-- JsDoc tags -->
        augments author borrows class constant constructor constructs default
        deprecated description event example exports field fileOverview function
        ignore inner lends link memberOf name namespace param private property
        public requires returns see since static throws type version
      </keyword-class>
    </keyword-classes>
    

    That’s it. Save the file and start Programmer’s Notepad. Now you’re able to apply custom styling to regular expressions and comment doc keywords. On the Keywords tab you can edit the keywords we defined above.

    Categories: computers Tags: ,
    1. July 28th, 2011 at 10:18 | #1

      Hell yea, i want put on paper something like this but didnt have date, may i repost this reckon up RegExp and CommentDoc Highlighting for JS to Programmer’s Notepad | Brain Assassin

    2. bstecklu
      August 15th, 2011 at 12:29 | #2

      Looks like apple changed its page again. The script hangs while retrieving the information with CPU load reaching 100%.

    1. No trackbacks yet.