High Sierra Comment/Uncomment

Hello guys,


Since I installed High Sierra I can not comment / uncomment on Xcode...


Does someone already face this issue?


I should precise that the command: sudo /usr/libexec/xpccachectl is no longer a fixing solution.


Alexandre.

Replies

I have the same issue. Tried to restart system/Xcode, rename Xcode. Nothing worked.

First up, before considering workarounds you should file a bug about this. This stuff is supposed to be completely automatic, so if you’re hitting problems then that’s definitely bugworthy.

It would be a good idea to include a sysdiagnose log with your bug report. See the instructions on our Bug Reporting > Profiles and Logs page.

Please post your bug number, just for the record.

Now, on to workarounds…

The Editor > Structure > Toggle Comments command is implemented via an Xcode source editor extension. This uses the same infrastructure as the public API — see WWDC 2016 Session 414 Using and Extending the Xcode Source Editor for details — it’s just that the extension happens to be built-in to Xcode.

These extensions, like all app extensions, are implemented using an internal framework call PlugInKit. PlugInKit depends on Launch Services to find extensions, and it’s not uncommon for that combination to get confused as to the available extensions.

PlugInKit has no API but it does have an associated command line tool, namely

pluginkit
. You can use this to dump all the extensions known to the system:
$ pluginkit -m -p com.apple.dt.Xcode.extension.source-editor

to get more information about them:

$ pluginkit -m -p com.apple.dt.Xcode.extension.source-editor -A -D -vvv

and to register (

-a
) and deregister (
-r
) them.

In my experience problems like this are usually caused by having multiple versions of Xcode installed and the system getting confused as to which built-in source editor extension to load. In the past I’ve been able to successfully work around this by deregistering the extensions that I don’t want Xcode to use and explicitly registering the extensions I do. You might be able to make progress in a similar way.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I had the same issue, once again, but as alluded to above, in High Sierra the file /usr/libexec/xpccachectl doesn't exist.


In addition, the above pluginkit commands above didn't find any plugins - the only Xcode related plugin I had was com.apple.dt.XcodeBuiltInExtensions(1.0), but the above pluginkit commands didn't find it.


I wasn't able to figure out how to deregister/rerigister extensions or which ones I needed, and I tried other tricks like renaming the Xcode app and restarting, but nothing worked. Then I noticed that I still had version 8 of Xcode.


The App Store didn't list any available updates, so I downloaded a new version of Xcode and the problem dissapeared: I can now toggle comments via either the shortcut key or the menu item. Presently the Editor > Structure > Toggle Comments item is available and not greyed out. Before it was greyed out and called something different like "Comment Section" without the word "Toggle".


In addition the above pluginkit commands presently find the following 2 plug-ins:

com.apple.dt.XCDocumenter.XCDocumenterExtension(1.0)

com.apple.dt.XcodeBuiltInExtensions(9.1)

Ok I will try to reinstall. Thx.

Guy, your reply is too long and not so much useful. It is not because of multiple extension and so on... It is just a bug due to High Sierra. So the best we can do, apparently, is to reinstall..

Deregistering(-r) with pluginkit is not a good idea as it seems registering(-a) silently fails. 😠

Oddly I was able to fix this by moving my xcode install right under /Applications. For versioning reasons, I had my xcode install under /Applications/Xcodes/9.2/Xcode.app instead of /Applications/Xcode.app. No reboot required, but I did Quit Xcode before doing it.