Allow continuous change monitoring for Xcode Extensions
Number:rdar://26892279 Date Originated:20-Jun-2016 04:05 PM
Status:Closed Resolved:27-Jun-2016 10:41 PM
Product:Developer Tools Product Version:Xcode 8.0(8S128d)
Classification: Reproducible:
I was thrilled to see the announcement about Xcode Source Editor Extensions. I'm the author of a plugin called CoPilot that allows collaborative editing (sort of like Google docs for Xcode, see for more details) and my hope was that I could turn what is essentially a hack into an officially supported extension.

Unfortunately, upon further inspection of the extension mechanism I found that I cannot port CoPilot to this new mechanism as it stands. At the same time I also learned that the old loading mechanism will not work anymore, either :(

It would be great if a future version of the plugin extension mechanism could be extended to allow my use case. For this to work I would essentially require a callback/notification whenever the source document changes. Whether it's just the changes or the whole document - that does not really matter.

I'm currently listening to the following notifications to track changes in text and selection:

- NSTextStorageDidProcessEditingNotification: upon receiving this I diff against the previous version and send the changes to any subscribed remote documents
- NSTextViewDidChangeSelectionNotification: upon receiving this I send the new selection 'coordinates' to any subscribed documents (in order for the remote observers to be able to display the local user's selection)

This would need be a continuous event stream to the plugin. The actions that are explicitly user triggered are the following:

- display a browser window (essentially a list of discovered shared documents)
- publish a document to make it available for other editors to connect to
- subscribe to a document, one previously published via publish above, picked from the list in the browser window

Only after a published document has been subsriced by one or more observers will the callback or notification mechanism be required to send changes to the extension, until the point when the connection is dropped. During that time the extension would need to be able to receive and apply changes to the editor without user intervention.

This is conceptually quite different from the blocking, synchronous approach that seems to be underlying the current mechanism. However, I still hope there is some way to allow for a plugin like CoPilot, because I believe it could be a very useful plugin for teaching, code review, or interviewing, just to name a few examples that spring to mind.

Also, while CoPilot currently only works on the local network via Bonjour discovery, I had already started to write a server component to allow ICE/STUN brokering of the connection across any internet connection. I'm still hopeful that this wasn't entirely in vain and could be made to work thanks to a further opening up of the extension mechanism.

Steps to Reproduce:

Expected Results:
Support of CoPilot-like extension functionality

Actual Results:
I can neither port CoPilot to Xcode 8 with the current extension mechanism nor can I continue to run it with the existing implementation, due to library validation.



Xcode 8



What was the word from Apple about this issue upon closure?

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!