I used the macro mentioned in this question to comment a text selection in the CSS editor in VS 2008. I am looking for another macro which uncomments comments.
Just write a similar module/method, I think that should work, I haven't tried, but this is what I think.
Please consider this as addition to the post that you have linked, you can look for the other details from that post.
Public Module UnCommentCSS
Sub UnCommentCSS()
Dim selection As TextSelection
selection = DTE.ActiveDocument.Selection
Dim selectedText As String
selectedText = selection.Text
If selectedText.Length > 0 _
and selectedText.StartsWith("/*") _
and selectedText.EndsWith("*/") Then
selectedText = selectedText.Split("*"c)
selection.Text = selectedText(1)
End If
End Sub
End Module
Note: this works if you have no nested * in between /* */
Otherwise you have to make necessary improvements/changes
As Brian Schmitt of IObservable suggests, you could use the same key to comment and uncomment your code, depending of course on whether or not it's already commented. The code he uses to achieve this is the following:
Sub CommentCSS()
If Not DTE.ActiveDocument.Name.EndsWith("css") Then Return
Try
DTE.UndoContext.Open("Comment CSS")
Dim txtSel As TextSelection = DTE.ActiveDocument.Selection
Dim currText As String = txtSel.Text
If currText.Length > 0 Then
Dim newTxt As String
If currText.Trim.StartsWith("/*") AndAlso currText.Trim.EndsWith("*/") Then
newTxt = currText.Replace("/*", "").Replace("*/", "")
Else
newTxt = "/*" + currText + "*/"
End If
txtSel.Delete()
txtSel.Insert(newTxt, vsInsertFlags.vsInsertFlagsInsertAtEnd)
End If
Finally
DTE.UndoContext.Close()
End Try
End Sub
I removed his comments from the code as they messed up SO's code coloring, but the option that he gives seems pretty convenient. Also, in the link provided above, he explains all about how to bind the shortcut keys to make it work right.