-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add flexibility for extending the LanguageClient #195
Comments
Actually I tried copying def my_client_factory() -> MyLanguageClient:
client = MyLanguageClient(
converter_factory=default_converter,
)
@client.feature(types.WORKSPACE_CONFIGURATION)
def configuration(client: LanguageClient, params: types.ConfigurationParams):
return [
client.get_configuration(section=item.section, scope_uri=item.scope_uri)
for item in params.items
]
... This works initially, but fails later when the feature handler is called. The first argument of the handler has type This means that it will be difficult/impossible to extract the feature registration code to a function that accepts any class extending |
That definitely sounds like a bug report for However, I'm fairly sure you can work around the issue for now by renaming your |
But yes, I agree there should be a mechanism to make it easy to use a custom client class. |
I see. Thanks for the doc pointer! Indeed renaming the parameter to So now there is nothing blocking an API change in I suggest simply moving the feature registration code into a That would allow me to provide a |
The API is made so that many aspects are customizable, and that's great! However I hit the following limitation.
ClientServerConfig
can be given aclient_factory
to replacemake_test_lsp_client
. That allows me to inject my own class that extendsLanguageClient
.However
make_test_lsp_client
does the registration of the handlers for capturing diagnostics, progress reporting, etc... I still want to benefit from that and currently I cannot reuse that.So would it be possible to move the registration of handlers to a reusable method that takes the client as a parameter?
Alternatively, could
make_test_lsp_client
be given a factory function to instantiate theLanguageClient
object? That would allow me to pass my own class.Thanks!
The text was updated successfully, but these errors were encountered: