Home Dashboard Directory Help
Search

CTP: Missing: Real uncomment a block by goldfinger


Status: 

Closed
 as Fixed Help for as Fixed


64
3
Sign in
to vote
Type: Suggestion
ID: 319307
Opened: 12/22/2007 12:38:51 AM
Access Restriction: Public
0
Workaround(s)
view

Description

I still miss the ability to uncomment a block
I know that there is a workaround with here-strings.
But I think powershell has to do more in this case like it has real uncomment characters.
$b=
@'
Uncomment line 1
Uncomment line 4
'@

@'
Uncomment line 3
Uncomment line 4
'@ >$null

Suggestion:
Real uncomment characters like /* */ :
/*
Powershell skip
this uncomment block
immediately
***
*/
Details
Sign in to post a comment.
Posted by NSkinner on 5/5/2011 at 11:04 AM
/* */ has worked well for me. Or if the ISE had a VS like function to comment and uncomment multi-lines.
Posted by Mehrdad Mirreza on 3/22/2011 at 1:45 AM
I would recommend one of these:

#(
commented-code
commented-code
#)

OR

#{
commented-code
commented-code
#}

Benefits:

1. nestable
2. extends the current syntax -- no new special character is needed
3. most likely backwards compatible -- would in worst case comment out a part, but nothing inside a script line would be interpreted as comment (like as symmetrical comment signs e.g. #/ /#, which need a opening marker character # and an closing charachter (/)

Posted by Mezzie on 2/17/2011 at 10:37 PM
What is there to debate? block comments are useful. Implement them already. Serious flaw that it was not part of the original spec.
Posted by mdkelley on 12/7/2010 at 9:24 AM
please add support for comment blocks! I don't care how you implement it (syntax) just let us know what it is.
Posted by pba_pl on 11/15/2010 at 1:39 AM
I prefer C# like syntax.
So alias // for the #
and /* */ for the block comment, please.
Posted by halr9000-me2 on 2/10/2008 at 4:18 PM
+1 more for "HERE comments" and doc strings as well.
Posted by dreeschkind on 1/24/2008 at 6:47 AM
I like the idea of a HERE-comment.

@#
this is a comment
#@

And I think we need a powerful doc-string functionality for PowerShell.
However, I agree that there are probably more important issues that need to be fixed.
Posted by nateva on 1/22/2008 at 9:19 AM
After reading through other posts I am in favor of multiline comments AND I can definately see a use for doc-string functionality.

I do believe a #-oriented syntax is the most consistent option. And perhaps a new special character could be used for them. There are at least two that aren't used in PS that I am aware of: ! ^

So, for example:

#!
comment
!#
Posted by Neil Fairall on 1/21/2008 at 6:35 PM
I was going to comment but I lost interest already. Aren't there things that really need fixing?
Posted by aqx on 1/21/2008 at 7:05 AM
I vote AGAINST multiline comments. They're mostly used as below:

/* Comment
* more comment
* more comment
*/

It's just stupid, and instead of one character you need more at every line.

Plain comments should be deprecated in favor of some doc-strings just like in Visual Studio. They can be extracted into separate help file and also used by IDE tools. Thus simple # is enough for short notes, and longer stories can be in doc-strings or in separate documents.

What is really needed is a tool to block syntactically incorrect parts of code, abandoned parts of code and so on. This is not a "comment". However I'd prefer to delete dead code instead of "commenting" it.

For me # is enough. YMMV.
Posted by Joel Bennett on 1/20/2008 at 4:29 PM
You can't use ## for block comments -- you would break too many existing scripts. And personally, I think it would be an inexcusably bad idea to use slashes for comments too, considering the need to use them for paths is what drives the choice of # in scripting languages in the first place.

What about making a HERE-comment:
@#
this is a comment
#@

As far as inline documentation ala C# ... I'd hate to imagine the way the current XML files would look inline ...
your 30 line script would be 300... ;)
Posted by DonJones on 1/20/2008 at 12:51 PM
Agreed - consistency in symbology.

/#
Comment
#/

#/
Comment
/#

##
Comment
##

Something like.
Posted by chrisbell on 1/19/2008 at 4:46 PM
Are there any plans for inline documentation? There's got be a way to elegantly implement multi-line comments into the interface, with a nice terse shortcut for comments. The evolution of the perl/ruby '=begin' and C# '///' perhaps?

Posted by MartyList on 1/19/2008 at 2:45 PM
I vote for something like
#/    /#
or
#/* */#
Sign in to post a workaround.