Select the Code to Comment. Press Ctrl + K . Press Ctrl + C .
you can also add comment by pressing Ctrl+shift+/ and shift+ / for one line.
Shortcut: You can use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U to Comment or Uncomment selected lines of text. Comments are used to help document what a program does and what the code with it does.
Line Comment hold both: Cmd + /
Block Comment hold all three: Cmd + Alt + /
Line Comment hold both: Cmd + + =
Block Comment hold all three: Cmd + Alt + + =
Line Comment hold both: Ctrl + /
Block Comment hold all three: Ctrl + Shift + /
Same way to remove the comment block.
To Provide Method Documentation comment type /**
and press Enter just above the method name (
It will create a block comment with parameter list and return type like this
/**
* @param userId
* @return
*/
public int getSubPlayerCountForUser(String userId){}
In spanish keyboard without changing anything I can make a comment with the keys:
cmd + -
OR
cmd + alt + -
This works because in english keyboard / is located at the same place than - on a spanish keyboard
Be sure you use the slash (/) on right side of keyboard.
For Line Comment:
Ctrl + /
For Block Comment:
Ctrl + Shift + /
You can see all keymap in Android Studio: Help ➤ Default Keymap Reference
On Mac and Turkish Keyboard it is (both for commenting out and uncommenting)
line comment: cmd +.
block comment: cmd+alt +.
An Example for a Mac OS X 10.5+ with a German layout keyboard without NumPads:
This way you can be sure that those keys are not mapped (except if you assigned them before to another function)
Keyboard shortcuts can be configured (and reviewed) via the Settings dialog, accessible via File -> Settings
.
Once this dialog appears, to review (and/or add) a shortcut, do the following:
Select Keymap in the list on the left. Note that there is a "Keymaps" option, and depending on the original selection, shortcuts assigned to a given feature differ based on the Keymap.
Type "comment" or text corresponding to the feature for which the keyboard shortcut is to be reviewed/assigned. Each match has a line entry in the list below, and keyboard shortcuts are shown right-justified along with the feature. For example, both CTRL+ALT+SLASH and CTRL+K, CTRL+C are the two assignments for creating a line comment.
To modify a shortcut:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With