diff --git a/package.json b/package.json index 5d63c2b8..9b8d8cfd 100644 --- a/package.json +++ b/package.json @@ -355,7 +355,13 @@ "xml.symbols.showReferencedGrammars": { "type": "boolean", "default": true, - "markdownDescription": "Show referenced grammars in the Outline. Default is `true.", + "markdownDescription": "Show referenced grammars in the Outline. Default is `true`.", + "scope": "window" + }, + "xml.extension.jars": { + "type": "array", + "default": [], + "markdownDescription": "An array of paths to JARs that should be contributed to the LemMinX classpath. This is intended to be used as a tool for developing extensions to vscode-xml.", "scope": "window" } } diff --git a/src/extension.ts b/src/extension.ts index 207e2199..8bdef9d1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -18,7 +18,7 @@ import * as path from 'path'; import * as os from 'os'; import { activateTagClosing, AutoCloseResult } from './tagClosing'; import { Commands } from './commands'; -import { onConfigurationChange, subscribeJDKChangeConfiguration } from './settings'; +import { getXMLConfiguration, onConfigurationChange, subscribeJDKChangeConfiguration } from './settings'; import { collectXmlJavaExtensions, onExtensionChange } from './plugin'; import { markdownPreviewProvider } from "./markdownPreviewProvider"; @@ -203,7 +203,7 @@ export function activate(context: ExtensionContext) { } } - let serverOptions = prepareExecutable(requirements, collectXmlJavaExtensions(extensions.all), context); + let serverOptions = prepareExecutable(requirements, collectXmlJavaExtensions(extensions.all, getXMLConfiguration().get("extension.jars", [])), context); languageClient = new LanguageClient('xml', 'XML Support', serverOptions, clientOptions); let toDispose = context.subscriptions; let disposable = languageClient.start(); @@ -245,7 +245,7 @@ export function activate(context: ExtensionContext) { if (extensions.onDidChange) {// Theia doesn't support this API yet context.subscriptions.push(extensions.onDidChange(() => { - onExtensionChange(extensions.all); + onExtensionChange(extensions.all, getXMLConfiguration().get("extension.jars", [])); })); } diff --git a/src/plugin.ts b/src/plugin.ts index d7bdc7b5..9e9e9f00 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -7,7 +7,7 @@ const glob = require('glob'); let existingExtensions: Array; -export function collectXmlJavaExtensions(extensions: readonly vscode.Extension[]): string[] { +export function collectXmlJavaExtensions(extensions: readonly vscode.Extension[], jars: string[]): string[] { const result = []; if (extensions && extensions.length) { for (const extension of extensions) { @@ -22,17 +22,20 @@ export function collectXmlJavaExtensions(extensions: readonly vscode.Extension[]) { +export function onExtensionChange(extensions: readonly vscode.Extension[], jars: string[]) { if (!existingExtensions) { return; } const oldExtensions = new Set(existingExtensions.slice()); - const newExtensions = collectXmlJavaExtensions(extensions); + const newExtensions = collectXmlJavaExtensions(extensions, jars); let hasChanged = ( oldExtensions.size !== newExtensions.length); if (!hasChanged) { for (const newExtension of newExtensions) {