-
Notifications
You must be signed in to change notification settings - Fork 58
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
How do I pass cutom Launcher for LanguageServerDefinition? #1187
Comments
I assume the analysis is correct so far and that @yanshudan needs a custom Gson configurator. What do you think of adding .configureGson(serverDefinition.getConfigureGson()) to lsp4e/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java Lines 365 to 372 in a096dad
and then the corresponding extension point to languageServer.xsd? The configureGson would by default do nothing to be backwards compatible. Or do you have a better idea? |
I don't have a better idea, this proposal seems good. |
@yanshudan , would you like to prepare a PR for the proposal? |
@rubenporras Yes, sure. Will get back to you when the PR is ready. |
Hi @rubenporras , I'm working on the PR and I'm wondering how I could pass a custom gson builder in my code once the PR gets merged. |
I noticed new Launcher.Builder<LanguageClient>()
.setLocalService(myserver)
.setRemoteInterface(LanguageClient.class)
.setInput(System.in)
.setOutput(System.out)
.configureGson(gsonBuilder -> gsonBuilder
.registerTypeAdapterFactory(new MyProgressParamsAdapter())) returns a
extension point mechanism to customize a gson builder, why not just customize a launcher?
|
@yanshudan good finding. Indeed it looks like you can try to define your own launcher builder, and get this particular class setting the appropriate gson configuration during that |
Agree, if that works, that is better. |
context: I need to custom a type adapter to handle responses from language server eclipse-lsp4j/lsp4j#865, and it turned out I need to pass a custom gson builder to a launcher builder like below:
But in
lsp4e/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java
Lines 365 to 372 in a096dad
But the class is abstract static &private, I cannot override
createLauncherBuilder
by extending the class or using dynamic proxy.lsp4e/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServersRegistry.java
Line 213 in a096dad
How could I resolve this?
The text was updated successfully, but these errors were encountered: