A keyboard shortcut to comment/uncomment the select text in Android Studio

后端 未结 9 1360
鱼传尺愫
鱼传尺愫 2021-01-31 13:48

How do I comment out several lines of text selected in the IDE with a control key combination?

I thought that Ctrl + Alt + C was the cor

相关标签:
9条回答
  • 2021-01-31 14:30

    Windows 10 and Android Studio: Ctrl + / (on small num pad), don't use Ctrl + Shift-7!

    0 讨论(0)
  • 2021-01-31 14:32

    At least in Android Studio 2.2.3 with default key mapping, to comment or uncomment a select text, same hotkeys are used as Toggle. Using the hotkeys changes the state from comment to uncomment, and next time Uncomment to comment on next and vice versa.

    1. Comment / uncomment a block of code

    Comment sample: /* --- Code block ---- */

    Hotkey: Ctrl + Shift + "/"

    Using the same key combinations again will "toggle" commenting or uncommenting the selection.

    2. Comment / uncomment a line of code

    Comment sample: // -- Code ---

    Hotkey: Ctrl + "/"

    Using the same key combinations again will "toggle" commenting or uncommenting the selection.

    Note: Key mapping can be changed to different schemes like eclipse, visual studio... or to the custom hotkeys in File -> Settings -> Keymap

    0 讨论(0)
  • 2021-01-31 14:35

    if you are findind keyboard shortcuts for Fix doc comment like this:

    /**
     * ...
     */
    

    you can do it by useing Live Template(setting - editor - Live Templates - add)

    /**
     * $comment$
     */
    
    0 讨论(0)
提交回复
热议问题