Color modifiers for added keywords and functions in SQL

  • I’m doing to SQL work and I would like to add some additional keywords and functions.
    However I need them to be another color.

    I was wondering if there is a way to add an additional Style in the the Style Configurator.
    Currently it shows

    I would like to add

    Additionally I would like to override some of the existing function colors which by default are the same color as the KEYWORD. For example SUM() should be recognized as a FUNCTION not a keyword, and be a different color such as pink.

  • I’ve found the styles.xml file which stores the styles.
    I’ve added the following line to SQL

    <WordsStyle name=“FUNCTION” styleID=“11” fgColor=“FF00FF” bgColor=“FFFFFF” fontName="" fontStyle=“1” fontSize="" keywordClass=“instre3” />

    I now see FUNCTION in the Style Configurator.
    However FUNCTION assumes all words are functions.
    It will NOT let me set a list of keywords. There is no textbox to define the keywords.
    I have a feeling it has to do with

    I’m not sure where instre is so I just created a random one and called it instre3.
    I think I may have to define instre3 in some other file, but don’t know which one.

    Which files are the instre defined in?
    How do I create a new one?

  • It is almost possible with what you are doing. The keywords are defined in langs.xml. However, there would have to be one or two minor modifications made to the source code of Notepad++ in order to use that extra list of keywords.

  • After some searching I found the file that contains the definitions for each language.


    I opened this file and searched for sql
    Then created my own instre2

    <Keywords name=“instre2”>over</Keywords>

    I now see FUNCTION, and see my keyword which has been hardcoded.
    However, the color has been applied to all words, not just the ones in the keyword list.

    I’m not sure why this is happening.
    I tried to override this by creating a style called DEFAULT set to black.
    But my words all stay the same color as FUNCTION.
    Somehow FUNCTION is setting the color for all words.

  • Part of the problem is styleID=“11” you might try 19 instead of 11. But again it won’t be able to use the list because of this line of code is only passing in 1 list and not 2.

Log in to reply