Skip to content

Dynamically register completion options for supporting clients #380

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 4 commits into from
Apr 6, 2021

Conversation

DavidGoldman
Copy link
Contributor

Using dynamic registration (when supported by the client) allows
us to provide different completion options for ObjC and Swift
files.

We should be able to expand this to other capabilities in the future
(e.g. semantic highlighting, execute command support).

Using dynamic registration (when supported by the client) allows
us to provide different completion options for ObjC and Swift
files.

We should be able to expand this to other capabilities in the future
(e.g. semantic highlighting, execute command support).
@DavidGoldman
Copy link
Contributor Author

@swift-ci please test

registry: CapabilityRegistry
) {
guard let completionOptions = server.completionProvider else { return }
guard registry.completionSupported && !registry.hasCompletionRegistrations(for: languages) else { return }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it bail out if there are already registrations? I would have expected we'd check if they're equal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have a conflicting registration for completion there's not much we can do unless we try to manually merge them - I guess I could just log it if that happens?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, how about we log a warning here unless the options are identical to what's already registered for that language.

@DavidGoldman
Copy link
Contributor Author

@swift-ci please test

@DavidGoldman
Copy link
Contributor Author

@swift-ci please test

@DavidGoldman
Copy link
Contributor Author

@swift-ci please test

@DavidGoldman DavidGoldman merged commit 3635d25 into swiftlang:main Apr 6, 2021
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.

2 participants