Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Color modifiers for added keywords and functions in SQL

    General Discussion
    2
    5
    5486
    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.
    • Michael Gonzalez
      Michael Gonzalez last edited by

      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
      KEYWORD
      NUMBER
      STRING
      STRING2
      OPERATOR
      COMMENT
      COMMENT LINE

      I would like to add
      FUNCTION

      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.

      1 Reply Last reply Reply Quote 0
      • Michael Gonzalez
        Michael Gonzalez last edited by

        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
        keywordClass=“instre3”

        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?

        1 Reply Last reply Reply Quote 0
        • dail
          dail last edited by dail

          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.

          1 Reply Last reply Reply Quote 0
          • Michael Gonzalez
            Michael Gonzalez last edited by

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

            langs.model.xml

            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.

            1 Reply Last reply Reply Quote 0
            • dail
              dail last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors