Can't comment selection

后端 未结 15 1320
暖寄归人
暖寄归人 2020-12-22 22:19

Sometimes, it seems I can\'t comment my code with the usual shortcut (command + /) under Xcode 8 Beta 4. The option is disabled in the menu (screen

15条回答
  •  半阙折子戏
    2020-12-22 22:53

    My situation is a bit different(stupid?): I found I can't comment any line from a particular part of a particular file. I tried all the methods above with Xcode 8.1 and Xcode 8.2, but got no luck. Finally I found it was caused by a comment trick like below,

    1 /*
    2 code 
    3 //*/
    4 code
    

    In Xcode, you can't comment line 2 with Cmd+/ because it has been commented already by /**/, which is fine. However, you can't even comment line 4 with Cmd+/, as Xcode may think it's still in a /* */ block, but it's actually not. If I remove // from line 3, then commenting line 4 works fine.

提交回复
热议问题