From d4cd6e1d93197acfb031bf590f80b2d960e78681 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 10 Sep 2020 11:48:27 -0400 Subject: [PATCH] Allow globs in `xml.javaExtensions` Paths supplied to `xml.javaExtensions` will be treated as globs. Signed-off-by: David Thompson --- README.md | 18 +++++++++++++++--- src/plugin.ts | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1097b3e5..f41d46f4 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,24 @@ To do that: ```json "contributes": { - "xml.javaExtensions": [ - "./jar/your-custom-xml-extension.jar" - ] + "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/angelozerr/lsp4xml-extensions-maven/blob/master/org.eclipse.lsp4xml.extensions.maven/src/main/java/org/eclipse/lsp4xml/extensions/maven/MavenCompletionParticipant.java#L28) for scope: ![VScode XML Maven](images/vscode-xml-maven.gif) diff --git a/src/plugin.ts b/src/plugin.ts index 08e3bb7f..d7bdc7b5 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -3,6 +3,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; import { Commands } from './commands'; +const glob = require('glob'); let existingExtensions: Array; @@ -15,7 +16,7 @@ export function collectXmlJavaExtensions(extensions: readonly vscode.Extension