Skip to content
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

Allow globs in xml.javaExtensions #324

Merged
merged 1 commit into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>;

Expand All @@ -15,7 +16,7 @@ export function collectXmlJavaExtensions(extensions: readonly vscode.Extension<a
const xmlJavaExtensions = contributesSection['xml.javaExtensions'];
if (Array.isArray(xmlJavaExtensions) && xmlJavaExtensions.length) {
for (const xmLJavaExtensionPath of xmlJavaExtensions) {
result.push(path.resolve(extension.extensionPath, xmLJavaExtensionPath));
result.push(...glob.sync(path.resolve(extension.extensionPath, xmLJavaExtensionPath)));
}
}
}
Expand Down