Enable block comments in SQL
SQL Prompt and SSMS do not have the option to create/remove block comments. This is a serious problem.
We SQL Prompt users would love the option to add/remove block comments in SQL, between the marks /* and */, because they sometimes serve very different purposes.
Inline comment options (Ctrl + K, Ctrl + C or Ctrl + K, Ctrl + U) are helpful, but they don't always do exactly what we need. Sometimes they can break things. See below.
Sometimes we need block comments that cover multiple lines.
/ Or comments where each line begins and ends with the markers. /
/ Like this. */
Sometimes inline comments, beginning with "- -", get inadvertently uncommented, and it can have major consequences. For one, it can be VERY hard to find the old textual comments. More importantly, lines of SQL code get uncommented, and they can alter or delete an entire table's contents.
-- A line of test code might feature a truncation from an earlier version
-- truncate table_name;
Can you please add a button/hot key combination that will add/remove comments that begin with /* and end with */?
This feature is available in other IDEs like Visual Studio and VS Code:
- Windows: Shift + Alt + A
- Mac: Shift + Option + A
Dan W commented
DIY manual work-around without all the fancy automatic actions:
code to use or hide
Remove the -- before /* to hide the section; Re-add -- before /* to enable the section. Leave "-- */" as-is because it's always valid
You can create a snippet - mine is called cb