-
Notifications
You must be signed in to change notification settings - Fork 93
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 to contribute extensions from another language server? #596
Comments
@martinlippert I'm so happy that you create this issue!
You can find a very basic lsp4xml extension with completion in
For the moment it's not possible to communicate inside the completion participant with another Language Server because it requires to:
But this requires microsoft/vscode-languageserver-node#526 I think vscode-xml could provides this binding features at the first step. |
Don't think this can implemented without XML LS and Spring Boot LS talking to each other. microsoft/vscode-languageserver-node#526 has been idle for some time now but I'd go with the command registration/execution approach. |
If I understand correctly, you want to manage communication with command like vscode-java provides. I think we can start with this feature. Have you the intention that Spring Boot vscode depends on vscode-xml ? |
@angelozerr Ideally I think we don't want the Spring Boot vscode extension to depend on the vscode-xml in a way that requires users to have both installed. I think the overall design here would be:
In case vscode-xml is around, our extension would call out to the Spring Boot vscode extension via the command mechanism that Alex described above - which basically means (from an abstract point of view) that our vscode-xml extension would call out to the Spring Boot language server to get some information - and once it got the information back, proceed with its work (resolving namespaces in our concrete case). The underlying problem for us here is that our namespace resolver implementation need to know the Java project context and the classpath of the project to lookup stuff (mappings and concrete XSD files). But the generic XML language server has no knowledge of that, therefore our namespace resolver would need to reach out to someone (the Spring Boot language server, in our case) to collect that information. Another side note: our plan is to use the same extension for the XML language server in Eclipse as well as VSCode... :-) |
Sorry I don't understand, you mean that you have your own vscode-xml which starts XML Language Server LemMinx ? Why you want to do that?
At first LemMinx provides URIResolverExtension API that you can implement and you can contribute it. Here an extension sample for resolving XML catalog namespace https://github.com/eclipse/lemminx/blob/7fe05f1319bb3b2ba5893c112e93bc66587e1b87/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/catalog/XMLCatalogURIResolverExtension.java#L51 If you expose a JDT LS command from Spring Boot LS which provides information for the Java classpath project, the XML Language Server could consume in your custom namespace resolver implemented by LemMinx URIResolverExtension, no? I think it's shame to have 2 XML Language Server which will be started (on by vscode-xml and one by your vscode-xml) because we will have double XML parsing file. Or perhaps I don't understand correctly your idea? |
Nooooo.... :-) I don't want to run a separate XML language server (by no means). The idea is to contribute an extension to the XML language server (as you described) and let the XML language server use that extension. Let me clarify on the comment above about the "dependency": |
Great!
Ok we have the same idea :)
It means that you will loose your namespace resolving feature?
Is there any reason to do that? For the user it's transparent the vscode-xml installation will be done when you will install Spring Boot, no?
Yes! |
Great thanks for the quick feedback. I'll go with the command registration approach for comm between XML and Boot LS. Once there is a working prototype the shape of the solution would be much clearer and we could collaborate on polishing it up :-) |
Great! I think we should have a work on vscode-xml side too. |
@BoykoAlex I need this custom command support for our internal extension (referenced grammars which show referenced XSD, DTD in the outline). Have you the intention to provide a PR for this support or do you prefer I implement it? Thanks for your feedback. |
@angelozerr yes, I'll create a draft PR for this today. It'd definitely need corrections. The intention of the PR is to merely show stuff our Spring XML extension needs, then we can figure out perhaps how best to wrap it in some nice API. It is going to be a PR for the XML server and for WWD XML, haven't worked on the VSCode side yet (not worried about it) but planning to |
This issue is fixed with the following PRs:
You can find doc about XML command :
Kudos to @BoykoAlex who has implemented those 2 PRs. |
I would like to write an extension to the lsp4xml language server that implements some Spring-specific things. The first issue I would like to tackle is to contribute a way to lookup an XSD namespace from the project classpath.
How do I contribute this extension to the lsp4xml language server? I know that I can implement the Java-based SPI, but how is my extension being found at runtime by the lsp4xml language server extension for VSCode or Eclipse, for example?
JDT.LS does something like dynamically looking up extensions and loading them into the OSGi runtime. Is something like that available for the lsp4xml language server, too?
The text was updated successfully, but these errors were encountered: