Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't comment selection

Tags:

comments

xcode

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 (screenshot below).

Do you have any idea why? Am I the only one having this issue?

Screenshot of the disabled command

EDIT: It seems to work again after restarting Xcode... Still looking from where it comes. It's a bit annoying...

EDIT2: It still occurs on Xcode 8.1. Maybe because I have 2 versions of Xcode installed (normal and beta)? Can't fix it anymore with a simple restart!

EDIT3: the proposed xpccachectl command to fix it doesn't exist on MacOS High Sierra.

like image 958
Tulleb Avatar asked Aug 09 '16 09:08

Tulleb


People also ask

How do you comment code on Android?

alt + c then alt + l (holding alt ) for line comment.

How do I comment out code in Xcode?

By selecting a few lines of code (pressing ⇧+↑ or ⇧+↓), you can comment a bunch of lines in a single shot with the ⌘ + / shortcut. If the lines are already comments, the same shortcut will uncomment them.

How do I comment out a block of code in IntelliJ?

Comment and uncomment blocks of codeFrom the main menu, select Code | Comment with Block Comment. Press Ctrl+Shift+/ .


2 Answers

Try this. Out of all the other suggestions, this was the only one that worked for me.

Go to your applications folder and rename Xcode to whatever you want, then open the Xcode. Check to see if the comment selection now works, if so, you can go back and rename Xcode to its default name. If not, rename Xcode back to its original name anyway, and continue searching for another solution.

This worked perfectly for me.

like image 148
joe_04_04 Avatar answered Oct 05 '22 21:10

joe_04_04


None of the workarounds worked for me after installing xcode 8.1 beta. I finally found that moving the Xcode beta out of the applications folder into a different location (desktop is where i put mine) then running sudo usr/libexec/xpccachectl fixed the issues i was having.

like image 35
dustin hullett Avatar answered Oct 05 '22 21:10

dustin hullett