Javascript: commentdoc highlighting

  • Paicap

    Paicap - 2012-09-16


    I am experiencing troubles in getting Javascript COMMENTDOC highlighting to work.

    I correctly set the "COMMENTDOC" colour styles in the "Style Configurator" panel without any success.

    Any help would be immensely appreciated.

    Many thanks,


    Notepad version 6.1.7
    Currently set style: Plastic code wrap
    Operating system: Windows 7 Pro (64 bit)

  • Anonymous - 2012-10-23

    The javascript highlighting in np++ is a bit mangled because it has to work with other languages which support embedding javascript (eg html, php). There are a few internal ids used by scilexer which conflict between languages. np++ does something to work around this. I only had a quick look at the source code so I'm not sure on all the details.

    I was able to work around this by modifying two files in %appdata%\notepad++

    stylers.xml has the colour style information. I added the following to the existing javascript node.
    <LexerType name="javascript" desc="Javascript" ext="pac">
    <WordsStyle name="TYPE WORD" styleID="16" fgColor="8000FF" bgColor="F2F4FF" fontName="" fontStyle="0" fontSize="" keywordClass="type1" />
    <WordsStyle name="STRINGEOL" styleID="51" fgColor="808080" bgColor="F2F4FF" fontName="" fontStyle="1" fontSize="" />
    <WordsStyle name="COMMENT LINE DOC" styleID="15" fgColor="008080" bgColor="F2F4FF" fontName="" fontStyle="0" fontSize="" />
    <WordsStyle name="COMMENT DOC KEYWORD" styleID="17" fgColor="008080" bgColor="F2F4FF" fontName="" fontStyle="1" fontSize="" />
    <WordsStyle name="COMMENT DOC KEYWORD ERROR" styleID="18" fgColor="800000" bgColor="F2F4FF" fontName="" fontStyle="0" fontSize="" />

    langs.xml contains the keywords. I added the type1 to highlight some of the default objects and functions. I also tried breaking up instre1 into two groups but that didn't work.
    <Language name="javascript" ext="js" commentLine="//" commentStart="/*" commentEnd="*/" tabSettings="132">
    <Keywords name="instre1">break case catch continue debugger default delete do else false finally for function if implements in instanceof interface let new null package private protected prototype public return static switch this throw true try typeof var void while with yield abstract boolean byte char class const double enum export extends final float goto import int long native short supersynchronized throws transient volatile</Keywords>
    <Keywords name="type1">arguments Array Boolean Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error eval EvalError function Function Infinity isFinite isNaN JSON Math NaN Number Object parseFloat parseInt RangeError ReferenceError RegExp String SyntaxError TypeError undefined URIError</Keywords>

    I think it is the comment line doc that conflicts with something so if you change it be aware it might be applied to something else.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks