Skip to content

Commit 243ab71

Browse files
committed
Download external resources preference
Signed-off-by: azerr <azerr@redhat.com>
1 parent 6421751 commit 243ab71

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ The following settings are supported:
8383
* `xml.trace.server`: Trace the communication between VS Code and the XML language server in the Output view. Default is `off`.
8484
* `xml.logs.client`: Enable/disable logging to the Output view. Default is `true`.
8585
* [`xml.catalogs`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#catalogs): Register XML catalog files.
86+
* `xml.downloadExternalResources.enabled`: Download external resources like referenced DTD, XSD. Default is `true`.
8687
* [`xml.fileAssociations`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#file-associations): Allows XML schemas/ DTD to be associated to file name patterns.
8788
* [`xml.format.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatenabled): Enable/disable ability to format document. Default is `true`.
8889
* [`xml.format.emptyElements`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatemptyelements): Expand/collapse empty elements. Default is `ignore`.

package.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@
177177
"default": true,
178178
"markdownDescription": "Enable/disable logging to the Output view. Default is `true`."
179179
},
180+
"xml.downloadExternalResources.enabled": {
181+
"type": "boolean",
182+
"default": true,
183+
"markdownDescription": "Download external resources like referenced DTD, XSD. Default is `true`.",
184+
"scope": "window"
185+
},
180186
"xml.catalogs": {
181187
"type": "array",
182188
"default": [],
@@ -320,16 +326,6 @@
320326
"default": false,
321327
"markdownDescription": "The option to put a closing bracket on a newline when `#xml.format.splitAttributes#` is `true`. Default value is `false`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22Formatting%22%2C%22section%22%3A%22xmlformatclosingbracketnewline%22%7D%5D) for more information."
322328
},
323-
"xml.preferences.quoteStyle": {
324-
"type": "string",
325-
"enum": [
326-
"single",
327-
"double"
328-
],
329-
"default": "double",
330-
"markdownDescription": "Preferred quote style to use for completion: `single` quotes, `double` quotes. Default is `double`.",
331-
"scope": "window"
332-
},
333329
"xml.completion.autoCloseTags": {
334330
"type": "boolean",
335331
"default": true,
@@ -347,6 +343,16 @@
347343
"default": false,
348344
"markdownDescription": "Enable/disable XML CodeLens. Default is `false`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22CodeLens%22%2C%22section%22%3A%22Code%20Lens%22%7D%5D) for information about CodeLens features"
349345
},
346+
"xml.preferences.quoteStyle": {
347+
"type": "string",
348+
"enum": [
349+
"single",
350+
"double"
351+
],
352+
"default": "double",
353+
"markdownDescription": "Preferred quote style to use for completion: `single` quotes, `double` quotes. Default is `double`.",
354+
"scope": "window"
355+
},
350356
"xml.preferences.showSchemaDocumentationType": {
351357
"type": "string",
352358
"default": "all",

src/settings/settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,11 @@ export function getXMLSettings(javaHome: string | undefined, logfile: string, ex
225225
// Check workspace trust
226226
const isWorkspaceTrusted = (workspace as any).isTrusted;
227227
if (isWorkspaceTrusted !== undefined && !isWorkspaceTrusted) {
228-
xml['xml']['validation']['resolveExternalEntities'] = false;
228+
xml['xml']['validation']['resolveExternalEntities']['enabled'] = false;
229+
xml['xml']['downloadExternalResources'] = false;
229230
} else {
230231
xml['xml']['validation']['resolveExternalEntities'] = workspace.getConfiguration('xml').get('validation.resolveExternalEntities', false);
232+
xml['xml']['downloadExternalResources']['enabled'] = workspace.getConfiguration('xml').get('downloadExternalResources.enabled', false);
231233
}
232234

233235
//applying externalXmlSettings to the xmlSettings

0 commit comments

Comments
 (0)