SQL syntax color does not support double commenting
-
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 -
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
-
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.
-
@PeterJones said in SQL syntax color does not support double commenting:
it’s that Notepad++ has chosen to always use the standard-SQL lexer
May not have to wait too long:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/13184
Cheers.
-
Nice. I am not going to bother with the script on this one, then. :-)
-
@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.
Cheers.
-
@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.
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.