Skip to content

[sourcekitd] Add support for having multiple notification handlers with correct sharing #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 3, 2020

Conversation

benlangmuir
Copy link
Contributor

Make it possible to correctly share the (global) sourcekitd connection for a given dylib, including multiplexing of notification handlers.

@benlangmuir
Copy link
Contributor Author

@swift-ci please test

Now that sourcekitd has its own module, clarify the naming of the
subdirectories in the primary language server.
The notification handler and initialize/shutdown APIs all modify global
state within the service, so handle them inside the wrapper to prevent
accidental misuse. Also add support for multiplexing the notification
handler, since it can be useful to have multiple handlers, especially
for global notifications.
For now, we only have one concrete implementation in sourcekit-lsp
itself, but it is useful for libraries to be able to wrap their own
sourcekitd implementation for example if they have an existing external
use of sourcekitd in C code.
Protect ourselves from ever having multiple sourcekitd instances for the
same path live at once, which is not safe.
@benlangmuir benlangmuir force-pushed the sourcekitd-sharing branch from 7d03292 to 0670fb5 Compare June 3, 2020 21:53
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@benlangmuir benlangmuir merged commit f40f610 into swiftlang:master Jun 3, 2020
@benlangmuir benlangmuir deleted the sourcekitd-sharing branch June 3, 2020 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant