forked from redhat-developer/vscode-xml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xml.extension.jars
to add LemMinX extension jars
Adds a new setting `xml.extension.jars`, where you can list jars to contribute to the LemMinX classpath. You can use this feature to test LemMinX extensions in VSCode. Closes redhat-developer#251 Signed-off-by: David Thompson <[email protected]>
- Loading branch information
1 parent
b44ceb9
commit 4f002c9
Showing
7 changed files
with
67 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Custom XML Extensions | ||
|
||
The [LemMinX - XML Language Server](https://github.com/eclipse/lemminx) can be extended to support custom completion, hover, validation, rename, etc by using the [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-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](https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/MavenLemminxExtension.java). | ||
* register your custom completion participant in the XML extension like [MavenCompletionParticipant](https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/MavenCompletionParticipant.java#L75) | ||
* register your custom XML extension with [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-spi) mechanism in the [/META-INF/services/org.eclipse.lemminx.services.extensions.IXMLExtension](https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/resources/META-INF/services/org.eclipse.lemminx.services.extensions.IXMLExtension) file. | ||
* build a JAR `your-custom-xml-extension.jar`. | ||
* create a `vscode extension` which embeds the `your-custom-xml-extension.jar` JAR and declares this JAR path in the `package.json`: | ||
|
||
```json | ||
"contributes": { | ||
"xml.javaExtensions": [ | ||
"./jar/your-custom-xml-extension.jar" | ||
] | ||
} | ||
``` | ||
|
||
* You can also list multiple jars or use glob patterns to specify the jars: | ||
|
||
```json | ||
"contributes": { | ||
"xml.javaExtensions": [ | ||
"./jar/dependencies/*.jar", | ||
"./jar/my-xml-extension.jar" | ||
] | ||
} | ||
``` | ||
|
||
You can see the [vscode-xml-maven](https://github.com/angelozerr/vscode-xml-maven) sample which registers custom maven completion [MavenCompletionParticipant](https://github.com/eclipse/lemminx-maven/blob/master/lemminx-maven/src/main/java/org/eclipse/lemminx/extensions/maven/MavenCompletionParticipant.java#L210) for scope: | ||
|
||
![demo of vscode xml maven suggesting different scopes for a dependency](./images/vscode-xml-maven.gif) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters