-
Notifications
You must be signed in to change notification settings - Fork 313
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
Conversation
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).
@swift-ci please test |
Sources/LanguageServerProtocol/SupportTypes/RegistrationOptions.swift
Outdated
Show resolved
Hide resolved
registry: CapabilityRegistry | ||
) { | ||
guard let completionOptions = server.completionProvider else { return } | ||
guard registry.completionSupported && !registry.hasCompletionRegistrations(for: languages) else { return } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@swift-ci please test |
Sources/LanguageServerProtocol/SupportTypes/RegistrationOptions.swift
Outdated
Show resolved
Hide resolved
Sources/LanguageServerProtocol/SupportTypes/RegistrationOptions.swift
Outdated
Show resolved
Hide resolved
@swift-ci please test |
@swift-ci please test |
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).