Skip to main content



      Home
Home » Newcomers » Newcomers » Deleting commented-out code
Deleting commented-out code [message #256864] Wed, 21 May 2008 09:59 Go to next message
Eclipse UserFriend
Originally posted by: ns_dkerber.ns_WarrenRogersAssociates.com

Does eclipse have a built-in function I can use to mass-delete
commented-out code, without removing programmer comments?

It seems like this should be doable in a couple of ways, but I don't
have the time to work on it myself, at least not right now...

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
Re: Deleting commented-out code [message #256892 is a reply to message #256864] Wed, 21 May 2008 11:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

You could use find+replace (CTRL-F or CTRL-H) to search thru files and
make regexp-based matches, then replace them with "".

Or you could pipe the file thru perl and do line replacements that way...

cat somefile.foo | perl -pe "s#//.+##g" > somefile.foo.out; mv -f
somefile.foo.out somefile.foo

Nick

ns_dkerber@ns_WarrenRogersAssociates.com wrote:
> Does eclipse have a built-in function I can use to mass-delete
> commented-out code, without removing programmer comments?
>
> It seems like this should be doable in a couple of ways, but I don't
> have the time to work on it myself, at least not right now...
>
Re: Deleting commented-out code [message #256945 is a reply to message #256892] Wed, 21 May 2008 16:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ns_dkerber.ns_WarrenRogersAssociates.com

In article <g11eif$6el$1@build.eclipse.org>, codeslave@ca.ibm.com
says...
> You could use find+replace (CTRL-F or CTRL-H) to search thru files and
> make regexp-based matches, then replace them with "".
>
> Or you could pipe the file thru perl and do line replacements that way...
>
> cat somefile.foo | perl -pe "s#//.+##g" > somefile.foo.out; mv -f
> somefile.foo.out somefile.foo

It seems like either one of those would leave blank lines in place of
commented lines, but it's a start...

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
Re: Deleting commented-out code [message #256947 is a reply to message #256945] Wed, 21 May 2008 17:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codeslave.ca.ibm.com

> It seems like either one of those would leave blank lines in place of
> commented lines, but it's a start...

Then use something like ESC-CTRL-F for formatting the whole document
according to template. Here's the one I use:

http://wiki.eclipse.org/EMF/Setting_up_a_development_environ ment#Configuring_Code_Templates.2C_Code_Formatter.2C_and_Imp ort_Order


--
Nick Boldt :: Release Engineer, IBM Toronto Lab
Eclipse Modeling :: http://www.eclipse.org/modeling
http://wiki.eclipse.org/index.php/User:Nickb
Re: Deleting commented-out code [message #256967 is a reply to message #256864] Thu, 22 May 2008 02:49 Go to previous message
Eclipse UserFriend
Originally posted by: none.domain.invalid

ns_dkerber@ns_WarrenRogersAssociates.com a écrit :
> Does eclipse have a built-in function I can use to mass-delete
> commented-out code, without removing programmer comments?
>
> It seems like this should be doable in a couple of ways, but I don't
> have the time to work on it myself, at least not right now...

Search for regexp: \R(//[^\n\r]*\R)+
Replace with regexp : \R

This way all lines begining with "//" are removed
Previous Topic:package explorer doesn't show source folders
Next Topic:Extension PopupMenu : Add icon to category menu
Goto Forum:
  


Current Time: Wed Sep 17 01:14:19 EDT 2025

Powered by FUDForum. Page generated in 0.28714 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top