Community
    • 登入

    Color modifiers for added keywords and functions in SQL

    已排程 已置頂 已鎖定 已移動 General Discussion
    5 貼文 2 Posters 6.1k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Michael GonzalezM
      Michael Gonzalez
      最後由 編輯

      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 條回覆 最後回覆 回覆 引用 0
      • Michael GonzalezM
        Michael Gonzalez
        最後由 編輯

        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 條回覆 最後回覆 回覆 引用 0
        • dailD
          dail
          最後由 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 條回覆 最後回覆 回覆 引用 0
          • Michael GonzalezM
            Michael Gonzalez
            最後由 編輯

            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 條回覆 最後回覆 回覆 引用 0
            • dailD
              dail
              最後由 編輯

              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 條回覆 最後回覆 回覆 引用 0
              • 第一個貼文
                最後的貼文
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors