The LemMinX - XML Language Server can be extended to support custom completion, hover, validation, rename, etc by using the Java Service Provider Interface (SPI) mechanism. vscode-xml provides the ability to use your custom XML support provider, by adding external jars to the XML language server's classpath.
To do that:
- create a Java project which provides a custom XML extension providing your custom completion, hover, validation, rename, etc:
- create the XML extension like MavenLemminxExtension.
- register your custom completion participant in the XML extension like MavenCompletionParticipant
- register your custom XML extension with Java Service Provider Interface (SPI) mechanism in the /META-INF/services/org.eclipse.lemminx.services.extensions.IXMLExtension file.
- build a JAR
your-custom-xml-extension.jar. - create a
vscode extensionwhich embeds theyour-custom-xml-extension.jarJAR and declares this JAR path in thepackage.json:
"contributes": {
"xml.javaExtensions": [
"./jar/your-custom-xml-extension.jar"
]
}- You can also list multiple jars or use glob patterns to specify the jars:
"contributes": {
"xml.javaExtensions": [
"./jar/dependencies/*.jar",
"./jar/my-xml-extension.jar"
]
}You can see the vscode-xml-maven sample which registers custom maven completion MavenCompletionParticipant for scope:
See PR 292
xml.workspace.executeCommand - command registered on VSCode client (via vscode-xml extension) to let other extensions execute commands on XML Language server
xml/executeClientCommand - XML Language server LSP extension to let XML LS extenders execute commands on the client. The command is made available via IXMLCommandService on the server side. See XML LS extensions docs
