Uncomment multiline code in eclipse2019 Community Moderator ElectionEclipse comment/uncomment shortcut?Cannot remove block comment in Eclipse after formattingEclipse: Can you format code on save?How can you speed up Eclipse?'Must Override a Superclass Method' Errors after importing a project into Eclipse“Debug certificate expired” error in Eclipse Android pluginsEclipse: Set maximum line length for auto formatting?Eclipse comment/uncomment shortcut?Can't start Eclipse - Java was started but returned exit code=13Eclipse ctrl+right does nothingEclipse (ctrl+shift+f) does nothingUncomment java code in eclipse shortcut
Algorithm to convert a fixed-length string to the smallest possible collision-free representation?
How do I express some one as a black person?
How do I locate a classical quotation?
Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?
A three room house but a three headED dog
Examples of a statistic that is not independent of sample's distribution?
Unreachable code, but reachable with exception
Am I not good enough for you?
"One can do his homework in the library"
Should I take out a loan for a friend to invest on my behalf?
How to pass a string to a command that expects a file?
PTIJ: How can I halachically kill a vampire?
Finding algorithms of QGIS commands?
What is the likely impact of grounding an entire aircraft series?
What is the chance of making a successful appeal to dismissal decision from a PhD program after failing the qualifying exam in the 2nd attempt?
Could a cubesat be propelled to the moon?
Is it true that real estate prices mainly go up?
Replacing Windows 7 security updates with anti-virus?
Do items de-spawn in Diablo?
The bar has been raised
How much stiffer are 23c tires over 28c?
Why doesn't this Google Translate ad use the word "Translation" instead of "Translate"?
What are some noteworthy "mic-drop" moments in math?
How to create a hard link to an inode (ext4)?
Uncomment multiline code in eclipse
2019 Community Moderator ElectionEclipse comment/uncomment shortcut?Cannot remove block comment in Eclipse after formattingEclipse: Can you format code on save?How can you speed up Eclipse?'Must Override a Superclass Method' Errors after importing a project into Eclipse“Debug certificate expired” error in Eclipse Android pluginsEclipse: Set maximum line length for auto formatting?Eclipse comment/uncomment shortcut?Can't start Eclipse - Java was started but returned exit code=13Eclipse ctrl+right does nothingEclipse (ctrl+shift+f) does nothingUncomment java code in eclipse shortcut
Yes, this could be duplicate of Eclipse comment/uncomment shortcut? But, answers given their are not working for my case.
I have formatted java code and When I select and use ctrl + shift + /
it looks like
/*
* if (isKilled) Log.i("TAG", "Killed");
*/
But when I use ctrl + shift + /
for above selected code, eclipse is not un-commenting my code.
I tried ctrl + shift +
, ctrl + shift + /
and ctrl +
. Nothing worked. I always manually remove *s even if commented code is very big.
How to do this? I also want *s to be removed.
eclipse
add a comment |
Yes, this could be duplicate of Eclipse comment/uncomment shortcut? But, answers given their are not working for my case.
I have formatted java code and When I select and use ctrl + shift + /
it looks like
/*
* if (isKilled) Log.i("TAG", "Killed");
*/
But when I use ctrl + shift + /
for above selected code, eclipse is not un-commenting my code.
I tried ctrl + shift +
, ctrl + shift + /
and ctrl +
. Nothing worked. I always manually remove *s even if commented code is very big.
How to do this? I also want *s to be removed.
eclipse
possible duplicate of Eclipse comment/uncomment shortcut?
– 1ac0
Feb 12 '14 at 10:02
1
Afaik there is a tendency to move away from/**/
comments in favor of//
ones. The//
comments are easily toggled for multiple lines byCtrl + Shift + C
. I guess that this simplicity of IDE support is the reason why many developers prefer//
over/**/
.
– noncom
Feb 12 '14 at 10:16
Yes//
could be easy. But is their a way for/***/
?
– Sundeep1501
Feb 12 '14 at 10:38
As of date in 2017 there is no solution for this !
– Sankalp
Apr 4 '17 at 11:00
This is so far the best solution I found stackoverflow.com/a/34553134/1053496.
– nantitv
Jun 20 '17 at 14:47
add a comment |
Yes, this could be duplicate of Eclipse comment/uncomment shortcut? But, answers given their are not working for my case.
I have formatted java code and When I select and use ctrl + shift + /
it looks like
/*
* if (isKilled) Log.i("TAG", "Killed");
*/
But when I use ctrl + shift + /
for above selected code, eclipse is not un-commenting my code.
I tried ctrl + shift +
, ctrl + shift + /
and ctrl +
. Nothing worked. I always manually remove *s even if commented code is very big.
How to do this? I also want *s to be removed.
eclipse
Yes, this could be duplicate of Eclipse comment/uncomment shortcut? But, answers given their are not working for my case.
I have formatted java code and When I select and use ctrl + shift + /
it looks like
/*
* if (isKilled) Log.i("TAG", "Killed");
*/
But when I use ctrl + shift + /
for above selected code, eclipse is not un-commenting my code.
I tried ctrl + shift +
, ctrl + shift + /
and ctrl +
. Nothing worked. I always manually remove *s even if commented code is very big.
How to do this? I also want *s to be removed.
eclipse
eclipse
edited May 23 '17 at 12:10
Community♦
11
11
asked Feb 12 '14 at 9:58
Sundeep1501Sundeep1501
99411125
99411125
possible duplicate of Eclipse comment/uncomment shortcut?
– 1ac0
Feb 12 '14 at 10:02
1
Afaik there is a tendency to move away from/**/
comments in favor of//
ones. The//
comments are easily toggled for multiple lines byCtrl + Shift + C
. I guess that this simplicity of IDE support is the reason why many developers prefer//
over/**/
.
– noncom
Feb 12 '14 at 10:16
Yes//
could be easy. But is their a way for/***/
?
– Sundeep1501
Feb 12 '14 at 10:38
As of date in 2017 there is no solution for this !
– Sankalp
Apr 4 '17 at 11:00
This is so far the best solution I found stackoverflow.com/a/34553134/1053496.
– nantitv
Jun 20 '17 at 14:47
add a comment |
possible duplicate of Eclipse comment/uncomment shortcut?
– 1ac0
Feb 12 '14 at 10:02
1
Afaik there is a tendency to move away from/**/
comments in favor of//
ones. The//
comments are easily toggled for multiple lines byCtrl + Shift + C
. I guess that this simplicity of IDE support is the reason why many developers prefer//
over/**/
.
– noncom
Feb 12 '14 at 10:16
Yes//
could be easy. But is their a way for/***/
?
– Sundeep1501
Feb 12 '14 at 10:38
As of date in 2017 there is no solution for this !
– Sankalp
Apr 4 '17 at 11:00
This is so far the best solution I found stackoverflow.com/a/34553134/1053496.
– nantitv
Jun 20 '17 at 14:47
possible duplicate of Eclipse comment/uncomment shortcut?
– 1ac0
Feb 12 '14 at 10:02
possible duplicate of Eclipse comment/uncomment shortcut?
– 1ac0
Feb 12 '14 at 10:02
1
1
Afaik there is a tendency to move away from
/**/
comments in favor of //
ones. The //
comments are easily toggled for multiple lines by Ctrl + Shift + C
. I guess that this simplicity of IDE support is the reason why many developers prefer //
over /**/
.– noncom
Feb 12 '14 at 10:16
Afaik there is a tendency to move away from
/**/
comments in favor of //
ones. The //
comments are easily toggled for multiple lines by Ctrl + Shift + C
. I guess that this simplicity of IDE support is the reason why many developers prefer //
over /**/
.– noncom
Feb 12 '14 at 10:16
Yes
//
could be easy. But is their a way for /***/
?– Sundeep1501
Feb 12 '14 at 10:38
Yes
//
could be easy. But is their a way for /***/
?– Sundeep1501
Feb 12 '14 at 10:38
As of date in 2017 there is no solution for this !
– Sankalp
Apr 4 '17 at 11:00
As of date in 2017 there is no solution for this !
– Sankalp
Apr 4 '17 at 11:00
This is so far the best solution I found stackoverflow.com/a/34553134/1053496.
– nantitv
Jun 20 '17 at 14:47
This is so far the best solution I found stackoverflow.com/a/34553134/1053496.
– nantitv
Jun 20 '17 at 14:47
add a comment |
8 Answers
8
active
oldest
votes
Try using Ctr+Shift+C
This should work
3
its not working
– Sundeep1501
Feb 12 '14 at 10:10
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
add a comment |
For me Remove Block Comment
(Ctrl + Shift + ) works but only if there is code on the first line of the comment, so your example does not work but:
/* if (isKilled) Log.i("TAG", "Killed");
*/
does work.
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
1
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
1
I tried with code on first line. Its removing/*
and*/
but not removing *s from second line
– Sundeep1501
Feb 12 '14 at 11:58
Yes, it only works with comments exactly as inserted byAdd Block Comment
- which does not add * on intermediate lines.
– greg-449
Feb 12 '14 at 12:15
1
if we format the code which is commented using/* */
, eclipse editor adds * for intermediate lines too.
– Sundeep1501
Feb 12 '14 at 13:10
|
show 1 more comment
I am having this problem since ever. Always had in mind that Ctrl + Shift + C would away be the right way to comment but it never "uncomment".
Instead just change for to use Ctrl + / (for groups also) , or Ctrl + Shift + / for /**/ if you prefer.
It never fails, do not stress yourself again.
add a comment |
One partial solution to this is to disable block comment formatting.
If you do that, Eclipse will not add * for intermediate lines in multiline block comments when you format the code. And so you will be able to remove such block comments with Ctrl+Shift+
or just by removing /*
and */
In Eclipse for PHP (Windows), in the main menu Window->Preferences->PHP->CodeStyle->Formatter->Edit->Comments
Uncheck "Enable block comment formatting"
add a comment |
It is basically a case when save actions is enabled in eclipse. When you put block comments using "Crtl + Shift + /" or by typing yourself as:
/*
line 1
line 2
line 3
*/
and save it, the editor formats it to
/*
* line 1
* line 2
* line 3
*/
* are added on each intermediate lines. This results "Crtl + Shift + " to fail to remove those "*" before the lines.
The solution is:
1- Use "Crtl + Shift + C" to comment and uncomment (toggle). Preferable one.
2- If you don't want to use "Crtl + Shift + C". This is a hack actually. When you save, the editor formats the code like:
/*
* line 1
* line 2
* line 3
*/
You intermediately undo (Crtl + Z) it. The editor will put it back to earlier stage but code is saved like:
/*
line 1
line 2
line 3
*/
Now you can use "Crtl + Shift + " to uncomment when needed. The * won't trouble you :)
add a comment |
This might not be as easy. But still it works!
I use Ctrl+F to get the Find and Replace window, check the Regular expressions check box and use this regex ^(s*)/?*/?(.*)$
and 12
in the replace part and click "Replace All".
If you want to uncomment only one commented code part, you can select that area and use the radio button "Selected lines" in the scope part.
Regex break up
^ #denotes start of the line. To avoid matching * in other part of the code.
( #first group. To preserve the indentation
s* #selects the tab/space. The indentation
) #first group is closed
/? matches the forward slash in the first line of comment
* matches the star(Asterik) in the comments. backward slash is used as a delimiter
/? matches the forward slash in the last line of comment
( #second group. To preserve the indentation
.* # the actual code to be uncommented
) #second group is closed
$ # till the end of the line
Hope this helps!
add a comment |
Select the lines of code u wanna comment/uncomment.
Then hit "Ctrl + / " to comment/uncomment.
add a comment |
In Eclipse,
To add and remove single line comments,
CNTRL+SHIFT+C
Example:
// if(i==1)
// ...
//
To add and remove multi line comments,
CNTRL+SHIFT+/ --> add
CNTRL+SHIFT+ --> remove
Example:
/* if(i==1)
...
*/
New contributor
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21724456%2funcomment-multiline-code-in-eclipse%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try using Ctr+Shift+C
This should work
3
its not working
– Sundeep1501
Feb 12 '14 at 10:10
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
add a comment |
Try using Ctr+Shift+C
This should work
3
its not working
– Sundeep1501
Feb 12 '14 at 10:10
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
add a comment |
Try using Ctr+Shift+C
This should work
Try using Ctr+Shift+C
This should work
answered Feb 12 '14 at 10:08
Pratik RoyPratik Roy
518415
518415
3
its not working
– Sundeep1501
Feb 12 '14 at 10:10
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
add a comment |
3
its not working
– Sundeep1501
Feb 12 '14 at 10:10
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
3
3
its not working
– Sundeep1501
Feb 12 '14 at 10:10
its not working
– Sundeep1501
Feb 12 '14 at 10:10
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
Check your key map. go to tools ->options then select key map tab. type "comment" in the search bar
– Pratik Roy
Feb 12 '14 at 10:15
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
It says toggle comment - java source code. I have tried but not working for *ed multiline code
– Sundeep1501
Feb 12 '14 at 10:51
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
Does not work with multiline code when comments have different level (// //// etc.)
– Sonique
Apr 15 '15 at 14:42
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
This works for only single line code blocks (//)
– dshgna
Apr 23 '15 at 10:31
add a comment |
For me Remove Block Comment
(Ctrl + Shift + ) works but only if there is code on the first line of the comment, so your example does not work but:
/* if (isKilled) Log.i("TAG", "Killed");
*/
does work.
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
1
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
1
I tried with code on first line. Its removing/*
and*/
but not removing *s from second line
– Sundeep1501
Feb 12 '14 at 11:58
Yes, it only works with comments exactly as inserted byAdd Block Comment
- which does not add * on intermediate lines.
– greg-449
Feb 12 '14 at 12:15
1
if we format the code which is commented using/* */
, eclipse editor adds * for intermediate lines too.
– Sundeep1501
Feb 12 '14 at 13:10
|
show 1 more comment
For me Remove Block Comment
(Ctrl + Shift + ) works but only if there is code on the first line of the comment, so your example does not work but:
/* if (isKilled) Log.i("TAG", "Killed");
*/
does work.
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
1
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
1
I tried with code on first line. Its removing/*
and*/
but not removing *s from second line
– Sundeep1501
Feb 12 '14 at 11:58
Yes, it only works with comments exactly as inserted byAdd Block Comment
- which does not add * on intermediate lines.
– greg-449
Feb 12 '14 at 12:15
1
if we format the code which is commented using/* */
, eclipse editor adds * for intermediate lines too.
– Sundeep1501
Feb 12 '14 at 13:10
|
show 1 more comment
For me Remove Block Comment
(Ctrl + Shift + ) works but only if there is code on the first line of the comment, so your example does not work but:
/* if (isKilled) Log.i("TAG", "Killed");
*/
does work.
For me Remove Block Comment
(Ctrl + Shift + ) works but only if there is code on the first line of the comment, so your example does not work but:
/* if (isKilled) Log.i("TAG", "Killed");
*/
does work.
answered Feb 12 '14 at 10:13
greg-449greg-449
90k1663100
90k1663100
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
1
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
1
I tried with code on first line. Its removing/*
and*/
but not removing *s from second line
– Sundeep1501
Feb 12 '14 at 11:58
Yes, it only works with comments exactly as inserted byAdd Block Comment
- which does not add * on intermediate lines.
– greg-449
Feb 12 '14 at 12:15
1
if we format the code which is commented using/* */
, eclipse editor adds * for intermediate lines too.
– Sundeep1501
Feb 12 '14 at 13:10
|
show 1 more comment
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
1
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
1
I tried with code on first line. Its removing/*
and*/
but not removing *s from second line
– Sundeep1501
Feb 12 '14 at 11:58
Yes, it only works with comments exactly as inserted byAdd Block Comment
- which does not add * on intermediate lines.
– greg-449
Feb 12 '14 at 12:15
1
if we format the code which is commented using/* */
, eclipse editor adds * for intermediate lines too.
– Sundeep1501
Feb 12 '14 at 13:10
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
True, But I am looking for multiline
– Sundeep1501
Feb 12 '14 at 10:40
1
1
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
This is multiline, you have to have code on the first line of the comment.
– greg-449
Feb 12 '14 at 10:55
1
1
I tried with code on first line. Its removing
/*
and */
but not removing *s from second line– Sundeep1501
Feb 12 '14 at 11:58
I tried with code on first line. Its removing
/*
and */
but not removing *s from second line– Sundeep1501
Feb 12 '14 at 11:58
Yes, it only works with comments exactly as inserted by
Add Block Comment
- which does not add * on intermediate lines.– greg-449
Feb 12 '14 at 12:15
Yes, it only works with comments exactly as inserted by
Add Block Comment
- which does not add * on intermediate lines.– greg-449
Feb 12 '14 at 12:15
1
1
if we format the code which is commented using
/* */
, eclipse editor adds * for intermediate lines too.– Sundeep1501
Feb 12 '14 at 13:10
if we format the code which is commented using
/* */
, eclipse editor adds * for intermediate lines too.– Sundeep1501
Feb 12 '14 at 13:10
|
show 1 more comment
I am having this problem since ever. Always had in mind that Ctrl + Shift + C would away be the right way to comment but it never "uncomment".
Instead just change for to use Ctrl + / (for groups also) , or Ctrl + Shift + / for /**/ if you prefer.
It never fails, do not stress yourself again.
add a comment |
I am having this problem since ever. Always had in mind that Ctrl + Shift + C would away be the right way to comment but it never "uncomment".
Instead just change for to use Ctrl + / (for groups also) , or Ctrl + Shift + / for /**/ if you prefer.
It never fails, do not stress yourself again.
add a comment |
I am having this problem since ever. Always had in mind that Ctrl + Shift + C would away be the right way to comment but it never "uncomment".
Instead just change for to use Ctrl + / (for groups also) , or Ctrl + Shift + / for /**/ if you prefer.
It never fails, do not stress yourself again.
I am having this problem since ever. Always had in mind that Ctrl + Shift + C would away be the right way to comment but it never "uncomment".
Instead just change for to use Ctrl + / (for groups also) , or Ctrl + Shift + / for /**/ if you prefer.
It never fails, do not stress yourself again.
answered Mar 17 '16 at 17:09
maihemaihe
337
337
add a comment |
add a comment |
One partial solution to this is to disable block comment formatting.
If you do that, Eclipse will not add * for intermediate lines in multiline block comments when you format the code. And so you will be able to remove such block comments with Ctrl+Shift+
or just by removing /*
and */
In Eclipse for PHP (Windows), in the main menu Window->Preferences->PHP->CodeStyle->Formatter->Edit->Comments
Uncheck "Enable block comment formatting"
add a comment |
One partial solution to this is to disable block comment formatting.
If you do that, Eclipse will not add * for intermediate lines in multiline block comments when you format the code. And so you will be able to remove such block comments with Ctrl+Shift+
or just by removing /*
and */
In Eclipse for PHP (Windows), in the main menu Window->Preferences->PHP->CodeStyle->Formatter->Edit->Comments
Uncheck "Enable block comment formatting"
add a comment |
One partial solution to this is to disable block comment formatting.
If you do that, Eclipse will not add * for intermediate lines in multiline block comments when you format the code. And so you will be able to remove such block comments with Ctrl+Shift+
or just by removing /*
and */
In Eclipse for PHP (Windows), in the main menu Window->Preferences->PHP->CodeStyle->Formatter->Edit->Comments
Uncheck "Enable block comment formatting"
One partial solution to this is to disable block comment formatting.
If you do that, Eclipse will not add * for intermediate lines in multiline block comments when you format the code. And so you will be able to remove such block comments with Ctrl+Shift+
or just by removing /*
and */
In Eclipse for PHP (Windows), in the main menu Window->Preferences->PHP->CodeStyle->Formatter->Edit->Comments
Uncheck "Enable block comment formatting"
edited Aug 24 '18 at 10:49
answered Apr 11 '17 at 13:15
CITBLCITBL
71321229
71321229
add a comment |
add a comment |
It is basically a case when save actions is enabled in eclipse. When you put block comments using "Crtl + Shift + /" or by typing yourself as:
/*
line 1
line 2
line 3
*/
and save it, the editor formats it to
/*
* line 1
* line 2
* line 3
*/
* are added on each intermediate lines. This results "Crtl + Shift + " to fail to remove those "*" before the lines.
The solution is:
1- Use "Crtl + Shift + C" to comment and uncomment (toggle). Preferable one.
2- If you don't want to use "Crtl + Shift + C". This is a hack actually. When you save, the editor formats the code like:
/*
* line 1
* line 2
* line 3
*/
You intermediately undo (Crtl + Z) it. The editor will put it back to earlier stage but code is saved like:
/*
line 1
line 2
line 3
*/
Now you can use "Crtl + Shift + " to uncomment when needed. The * won't trouble you :)
add a comment |
It is basically a case when save actions is enabled in eclipse. When you put block comments using "Crtl + Shift + /" or by typing yourself as:
/*
line 1
line 2
line 3
*/
and save it, the editor formats it to
/*
* line 1
* line 2
* line 3
*/
* are added on each intermediate lines. This results "Crtl + Shift + " to fail to remove those "*" before the lines.
The solution is:
1- Use "Crtl + Shift + C" to comment and uncomment (toggle). Preferable one.
2- If you don't want to use "Crtl + Shift + C". This is a hack actually. When you save, the editor formats the code like:
/*
* line 1
* line 2
* line 3
*/
You intermediately undo (Crtl + Z) it. The editor will put it back to earlier stage but code is saved like:
/*
line 1
line 2
line 3
*/
Now you can use "Crtl + Shift + " to uncomment when needed. The * won't trouble you :)
add a comment |
It is basically a case when save actions is enabled in eclipse. When you put block comments using "Crtl + Shift + /" or by typing yourself as:
/*
line 1
line 2
line 3
*/
and save it, the editor formats it to
/*
* line 1
* line 2
* line 3
*/
* are added on each intermediate lines. This results "Crtl + Shift + " to fail to remove those "*" before the lines.
The solution is:
1- Use "Crtl + Shift + C" to comment and uncomment (toggle). Preferable one.
2- If you don't want to use "Crtl + Shift + C". This is a hack actually. When you save, the editor formats the code like:
/*
* line 1
* line 2
* line 3
*/
You intermediately undo (Crtl + Z) it. The editor will put it back to earlier stage but code is saved like:
/*
line 1
line 2
line 3
*/
Now you can use "Crtl + Shift + " to uncomment when needed. The * won't trouble you :)
It is basically a case when save actions is enabled in eclipse. When you put block comments using "Crtl + Shift + /" or by typing yourself as:
/*
line 1
line 2
line 3
*/
and save it, the editor formats it to
/*
* line 1
* line 2
* line 3
*/
* are added on each intermediate lines. This results "Crtl + Shift + " to fail to remove those "*" before the lines.
The solution is:
1- Use "Crtl + Shift + C" to comment and uncomment (toggle). Preferable one.
2- If you don't want to use "Crtl + Shift + C". This is a hack actually. When you save, the editor formats the code like:
/*
* line 1
* line 2
* line 3
*/
You intermediately undo (Crtl + Z) it. The editor will put it back to earlier stage but code is saved like:
/*
line 1
line 2
line 3
*/
Now you can use "Crtl + Shift + " to uncomment when needed. The * won't trouble you :)
answered Jan 25 '16 at 12:35
DexterDexter
1,44712129
1,44712129
add a comment |
add a comment |
This might not be as easy. But still it works!
I use Ctrl+F to get the Find and Replace window, check the Regular expressions check box and use this regex ^(s*)/?*/?(.*)$
and 12
in the replace part and click "Replace All".
If you want to uncomment only one commented code part, you can select that area and use the radio button "Selected lines" in the scope part.
Regex break up
^ #denotes start of the line. To avoid matching * in other part of the code.
( #first group. To preserve the indentation
s* #selects the tab/space. The indentation
) #first group is closed
/? matches the forward slash in the first line of comment
* matches the star(Asterik) in the comments. backward slash is used as a delimiter
/? matches the forward slash in the last line of comment
( #second group. To preserve the indentation
.* # the actual code to be uncommented
) #second group is closed
$ # till the end of the line
Hope this helps!
add a comment |
This might not be as easy. But still it works!
I use Ctrl+F to get the Find and Replace window, check the Regular expressions check box and use this regex ^(s*)/?*/?(.*)$
and 12
in the replace part and click "Replace All".
If you want to uncomment only one commented code part, you can select that area and use the radio button "Selected lines" in the scope part.
Regex break up
^ #denotes start of the line. To avoid matching * in other part of the code.
( #first group. To preserve the indentation
s* #selects the tab/space. The indentation
) #first group is closed
/? matches the forward slash in the first line of comment
* matches the star(Asterik) in the comments. backward slash is used as a delimiter
/? matches the forward slash in the last line of comment
( #second group. To preserve the indentation
.* # the actual code to be uncommented
) #second group is closed
$ # till the end of the line
Hope this helps!
add a comment |
This might not be as easy. But still it works!
I use Ctrl+F to get the Find and Replace window, check the Regular expressions check box and use this regex ^(s*)/?*/?(.*)$
and 12
in the replace part and click "Replace All".
If you want to uncomment only one commented code part, you can select that area and use the radio button "Selected lines" in the scope part.
Regex break up
^ #denotes start of the line. To avoid matching * in other part of the code.
( #first group. To preserve the indentation
s* #selects the tab/space. The indentation
) #first group is closed
/? matches the forward slash in the first line of comment
* matches the star(Asterik) in the comments. backward slash is used as a delimiter
/? matches the forward slash in the last line of comment
( #second group. To preserve the indentation
.* # the actual code to be uncommented
) #second group is closed
$ # till the end of the line
Hope this helps!
This might not be as easy. But still it works!
I use Ctrl+F to get the Find and Replace window, check the Regular expressions check box and use this regex ^(s*)/?*/?(.*)$
and 12
in the replace part and click "Replace All".
If you want to uncomment only one commented code part, you can select that area and use the radio button "Selected lines" in the scope part.
Regex break up
^ #denotes start of the line. To avoid matching * in other part of the code.
( #first group. To preserve the indentation
s* #selects the tab/space. The indentation
) #first group is closed
/? matches the forward slash in the first line of comment
* matches the star(Asterik) in the comments. backward slash is used as a delimiter
/? matches the forward slash in the last line of comment
( #second group. To preserve the indentation
.* # the actual code to be uncommented
) #second group is closed
$ # till the end of the line
Hope this helps!
answered Feb 1 '16 at 5:40
RamRam
3,16411733
3,16411733
add a comment |
add a comment |
Select the lines of code u wanna comment/uncomment.
Then hit "Ctrl + / " to comment/uncomment.
add a comment |
Select the lines of code u wanna comment/uncomment.
Then hit "Ctrl + / " to comment/uncomment.
add a comment |
Select the lines of code u wanna comment/uncomment.
Then hit "Ctrl + / " to comment/uncomment.
Select the lines of code u wanna comment/uncomment.
Then hit "Ctrl + / " to comment/uncomment.
answered Apr 13 '16 at 8:00
Dean WoodsDean Woods
12
12
add a comment |
add a comment |
In Eclipse,
To add and remove single line comments,
CNTRL+SHIFT+C
Example:
// if(i==1)
// ...
//
To add and remove multi line comments,
CNTRL+SHIFT+/ --> add
CNTRL+SHIFT+ --> remove
Example:
/* if(i==1)
...
*/
New contributor
add a comment |
In Eclipse,
To add and remove single line comments,
CNTRL+SHIFT+C
Example:
// if(i==1)
// ...
//
To add and remove multi line comments,
CNTRL+SHIFT+/ --> add
CNTRL+SHIFT+ --> remove
Example:
/* if(i==1)
...
*/
New contributor
add a comment |
In Eclipse,
To add and remove single line comments,
CNTRL+SHIFT+C
Example:
// if(i==1)
// ...
//
To add and remove multi line comments,
CNTRL+SHIFT+/ --> add
CNTRL+SHIFT+ --> remove
Example:
/* if(i==1)
...
*/
New contributor
In Eclipse,
To add and remove single line comments,
CNTRL+SHIFT+C
Example:
// if(i==1)
// ...
//
To add and remove multi line comments,
CNTRL+SHIFT+/ --> add
CNTRL+SHIFT+ --> remove
Example:
/* if(i==1)
...
*/
New contributor
New contributor
answered Mar 6 at 16:24
harshaharsha
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21724456%2funcomment-multiline-code-in-eclipse%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
possible duplicate of Eclipse comment/uncomment shortcut?
– 1ac0
Feb 12 '14 at 10:02
1
Afaik there is a tendency to move away from
/**/
comments in favor of//
ones. The//
comments are easily toggled for multiple lines byCtrl + Shift + C
. I guess that this simplicity of IDE support is the reason why many developers prefer//
over/**/
.– noncom
Feb 12 '14 at 10:16
Yes
//
could be easy. But is their a way for/***/
?– Sundeep1501
Feb 12 '14 at 10:38
As of date in 2017 there is no solution for this !
– Sankalp
Apr 4 '17 at 11:00
This is so far the best solution I found stackoverflow.com/a/34553134/1053496.
– nantitv
Jun 20 '17 at 14:47