Menu

php functions highlight

2006-08-10
2012-11-14
  • Nobody/Anonymous

    I love this editor.
    However, I do have a little problem.
    PHP functions (trim, str_replace, substr,...) are not highlighted. Of course I want a different color than the one used for custom words (and, or, array, break...)
    Can any1 help me?
    10x
    bbop

     
    • pcarini

      pcarini - 2008-07-03

      I'll second this - I'd love to see different styling for keywords vs. built in functions.  I tried adding my own <Keywords> list in langs.xml, but I can't seem to get NP++ to pay attention to it.

      Thanks,
      -pc

       
    • Vexator

      Vexator - 2008-07-09

      there is a way...

      open stylers.xml

      find <LexerType name="php" desc="php" ext="php4 php5">
      find and copy <WordsStyle name="WORD" ... />
      change name to "WORD_2"
      change keywordClass to "instre2"
      change styleID to "128"?
      so it looks like that:
      <WordsStyle name="WORD" styleID="121" ... keywordClass="instre1" />
      <WordsStyle name="WORD_2" styleID="128" ... keywordClass="instre2" />

      save the file

      open langs.xml

      find <Language name="php" ext="php php3 phtml" ... >
      find <Keywords name="instre1">...</Keywords>
      create <Keywords name="instre2"></Keywords>

      save the file

      now close NPP, open NPP
      go to the Settings --> Styler Conf.
      now you have old WORD with old functions and new WORD_2 without any. You can now put Your own strings to highlight with new color

       
  • Anonymous

    Anonymous - 2010-03-28

    This does not seem to work with NPP 5.6.8, fresh, clean install. The described procedure itself works, I can see the new WORD_2 style in Style Configurator.

    But the new added styleID 128 is not recognized by NPP, I can change styles etc. but they are not applied to the editor. I have re-started NPP of course, and tried many things.

    If I e.g. exchange the 128 with existing 121 then I can see style-changes done for WORD_2 but they apply to keywords instre1

    If I replace all styleIDs for php with 1,2,3,4… no styling at all is made.

    Are the styleIDs now (pre)defined somewhere else in NPP?

     
  • cchris

    cchris - 2010-03-28

    They are hardcoded in SciLexer.dll actuallly, so I wonder how the styleID=128 trick could ever work.

    CChris

     
  • Anonymous

    Anonymous - 2010-03-28

    Thanks for info. That's what I though after my tries, I even loaded SciLexer.dll into binary-editor and tried to find something there.

    Can you add an extra id for php in SciLexer.dll ? Would be really very good to have function-names (instre2) different styled as reserved words (instre1).

     
  • cchris

    cchris - 2010-03-29

    notepad++ has always gotten language support unalduterated from Scintilla, so as to avoid headaches when a new version comes up. So this should be better asked to the Scintilla project.

    CChris