• Login
Community
  • Login

SQL syntax color does not support double commenting

Scheduled Pinned Locked Moved Blogs
7 Posts 3 Posters 1.8k Views
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.
  • J
    Jan N. Pedersen
    last edited by PeterJones Mar 8, 2023, 1:53 PM Mar 8, 2023, 7:50 AM

    I have comments in my SQL like /* --- comment ---*/ but I also sometimes comment out blocks of script like -

    /*
    /*--- comment ---*/
    SELECT . . .
    */
    

    The above SQL is shown by syntax coloring as active.
    —

    moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

    P 1 Reply Last reply Mar 8, 2023, 2:16 PM Reply Quote 0
    • P
      PeterJones @Jan N. Pedersen
      last edited by PeterJones Mar 8, 2023, 2:17 PM Mar 8, 2023, 2:16 PM

      @Jan-N-Pedersen ,

      Notepad++ uses a library called “Scintilla” for the syntax highlighting. After discovering that SQL does indeed allow nested comments , I just went and verified that the Scintilla library that we use does not correctly parse nested comments.

      It cannot be fixed in Notepad++ until it is fixed in Scintilla. I have put in a bug report with Scintilla , but there’s no guarantee they will fix it. If they do, then it may be a few Notepad++ versions before N++ has updated to the newest Scintilla.

      ----

      Useful References

      • Please Read Before Posting
      • Formatting Forum Posts
      P 1 Reply Last reply Mar 8, 2023, 10:38 PM Reply Quote 1
      • P
        PeterJones @PeterJones
        last edited by Mar 8, 2023, 10:38 PM

        It cannot be fixed in Notepad++ until it is fixed in Scintilla. I have put in a bug report with Scintilla ,

        It turns out that Scintilla/Lexilla has a separate lexer for MS-SQL compared to the other SQL variants. In SciTE, if I enable that lexer, it handles the nested comments okay. So it’s not a bug, it’s that Notepad++ has chosen to always use the standard-SQL lexer.

        Which means, if you are willing to install the PythonScript plugin, I could give you a script (maybe tomorrow) that would enable the MS-SQL lexer for you, and switch from SQL to MS-SQL on your SQL files. So if you are interested and willing to install that plugin, let me know.

        M 1 Reply Last reply Mar 8, 2023, 11:57 PM Reply Quote 0
        • M
          Michael Vincent @PeterJones
          last edited by Mar 8, 2023, 11:57 PM

          @PeterJones said in SQL syntax color does not support double commenting:

          it’s that Notepad++ has chosen to always use the standard-SQL lexer

          @Jan-N-Pedersen

          May not have to wait too long:

          https://github.com/notepad-plus-plus/notepad-plus-plus/pull/13184

          Cheers.

          P 1 Reply Last reply Mar 9, 2023, 12:23 AM Reply Quote 3
          • P
            PeterJones @Michael Vincent
            last edited by Mar 9, 2023, 12:23 AM

            @Michael-Vincent ,

            Nice. I am not going to bother with the script on this one, then. :-)

            M 1 Reply Last reply Mar 14, 2023, 11:29 AM Reply Quote 2
            • M
              Michael Vincent @PeterJones
              last edited by Mar 14, 2023, 11:29 AM

              @PeterJones said in SQL syntax color does not support double commenting:

              Nice. I am not going to bother with the script on this one, then. :-)

              PR was just added to master. Looks like next version will have it, or you can test the artifact right now.

              https://github.com/notepad-plus-plus/notepad-plus-plus/commit/01bbebf825acaa458af7afaa27b0f6269310451b

              Cheers.

              M 1 Reply Last reply Mar 14, 2023, 6:15 PM Reply Quote 2
              • M
                Michael Vincent @Michael Vincent
                last edited by Mar 14, 2023, 6:15 PM

                @Michael-Vincent said in SQL syntax color does not support double commenting:

                PR was just added to master. Looks like next version will have it, or you can test the artifact right now.

                86dd6740-3ff4-499f-b740-0e710a2568e5-image.png

                Looks like it’s working …

                NOTE: Customized theme in the screenshot. The ‘stylers.model.xml’ has been updated for the default theme to include MS-SQL.

                Cheers.

                1 Reply Last reply Reply Quote 2
                6 out of 7
                • First post
                  6/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors