Home Dashboard Directory Help
Search

ISE V3 - Need to be able to Comment a series of lines in a block of code. by MaxTrinidad


Status: 

Closed
 as Fixed Help for as Fixed


48
0
Sign in
to vote
Type: Suggestion
ID: 711231
Opened: 12/3/2011 8:13:52 AM
Access Restriction: Public
3
Workaround(s)
view

Description

I can't comment a block of code.

Just a suggestion that may help all newbies in using PowerShell ISE V3 to be able to highlight a block of code (this code be a function with 50 lines) to be commented out. This could be added in the ribbon menu and available when doing a right-click to the highlighted code.

PS... in the question "How often does this happen?", there's no option for not available.
:)
Details
Sign in to post a comment.
Posted by Microsoft on 5/1/2014 at 8:40 PM
We added this in v3. Try this:
Put cursor on Column 1 in a script
Press Alt + Shift + Up/Down Arrow Keys to block select lines to comment
Press # to add comment
Posted by deadlydog on 6/20/2013 at 10:11 AM
I agree that this should be provided out of the box. In the meantime I show how you can get this functionality within a couple minutes by using the add-on I made on my blog at http://blog.danskingdom.com/powershell-ise-multiline-comment-and-uncomment-done-right-and-other-ise-gui-must-haves/
Posted by Joel 'Jaykul' Bennett on 1/25/2012 at 6:39 PM
Don't forget to UNCOMMENT a block too.
Sign in to post a workaround.
Posted by LostAtC5 on 8/23/2013 at 10:44 AM
If I have a block of code to comment and uncomment frequently I wrap it in block comments then to uncomment just change the first "<#" to "#<#".

<#
commented
#>

#<#
uncommented
#>
Posted by deadlydog on 6/20/2013 at 10:11 AM
I show how you can get this functionality within a couple minutes by using the add-on I made on my blog at http://blog.danskingdom.com/powershell-ise-multiline-comment-and-uncomment-done-right-and-other-ise-gui-must-haves/
Posted by Joel 'Jaykul' Bennett on 1/25/2012 at 6:39 PM
position the cursor at the left edge of the topmost line to be commented out, HOLD alt + shift, press "DOWN ARROW" once for each line you want to comment out, then press "#"

To uncomment, do the same thing except hit DEL instead of "#" ;-)