Xcode 8 Beta 4 - Comment Shortcut Disabled

2019-01-12 17:51发布

I just updated to Xcode 8 Beta 4 and the shortcut cmd + / to comment a line is not working..

In the dropdown menu it's disabled:

enter image description here

There's a way to activate it again?

12条回答
【Aperson】
2楼-- · 2019-01-12 18:12

As explained there, here's a solution that doesn't require a reboot:

  1. Close Xcode
  2. In the Application folder, rename Xcode.app (or similar) to Xcode2.app. You might need to type in your password.
  3. Open Xcode, then close it.
  4. Rename Xcode2.app back to what it was before.
  5. (Optional) Spend 5 minutes wondering why this worked.
查看更多
Anthone
3楼-- · 2019-01-12 18:13

This made it for me:

Goto System Preferences -> Keyboard -> Shortcuts -> App Shortcuts

Add a new shortcut like this:

enter image description here

Voila! It works for me!

As you can see the shortcut you choose will also end up besides this command in Editor menu in Xcode.

enter image description here

查看更多
贼婆χ
4楼-- · 2019-01-12 18:14

If Cmd-/ still doesn't work in Xcode 8 on an OS X 10.11 (and apparently on a macOS Sierra - thanks to @DanBlakemore), and sudo /usr/libexec/xpccachectl and a reboot didn't help, try the following.

  1. Close Xcode.
  2. Open /Applications in Finder, and rename Xcode.app to Xcode2.app (or any other name).
  3. Rename it back to Xcode.app, and relaunch.

It should work now.

The problem seems to be that for whatever reason the system "uninstalls" Xcode extensions at some point, and won't "install" them again. This can be checked by opening Console, and grepping for INSTALL. If you have INSTALLED/UNINSTALLED for com.apple.dt.XcodeBuiltInExtensions, it won't work if UNINSTALLED was the last action on it, and will work it if was INSTALLED.

Figured this out when debugging an Xcode 8 extension.

查看更多
虎瘦雄心在
5楼-- · 2019-01-12 18:15

Go to App Store, check for system update(iTunes, MacOSX). Update all of them.

It should be fixed once its done.

查看更多
Evening l夕情丶
6楼-- · 2019-01-12 18:20

Just update to Xcode8 release, then open Xcode8 and restart Mac.

https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html

To use the Editor's Comment/Uncomment Selection and Add Documentation commands—as well as other installed Xcode Extensions—on OS X version 10.11, launch Xcode and install additional system components, then restart your Mac. (26106213)

查看更多
兄弟一词,经得起流年.
7楼-- · 2019-01-12 18:22

I fixed it following the steps here: https://twitter.com/kolpanic/status/763323546814844928

In Terminal: sudo /usr/libexec/xpccachectl

Reboot your system.

查看更多
登录 后发表回答