Skip to content

redhat-developer/vscode-xml

Repository files navigation

XML Language Support by Red Hat

Join the chat at https://gitter.im/redhat-developer/vscode-xml Visual Studio Marketplace Installs eslint github action

Description

This VS Code extension provides support for creating and editing XML documents, based on the LemMinX XML Language Server.

Basic features

Features

Regular font Italics font
enabled by default requires additional configuration to enable

See the changelog for the latest release.

You might also find useful information in the Online XML Documentation or you can read this documentation inside vscode with the command Open XML Document available with Ctrl+Shift+P:

XML Open Documentation

Requirements

For running the binary version:

  • Windows, macOS, or Linux, on a x86_64 CPU
    • We do not currently support running on Linux installations without libc present
  • Java is not required for this version
  • The binary is automatically downloaded by vscode-xml if it is needed, with no additional action required on the part of the user.

For running the Java version (required if you want to run extensions to the base XML features):

  • Java JDK (or JRE) 8 or more recent
  • Ensure Java path is set in either:
    • xml.java.home in VSCode preferences
    • java.home in VSCode preferences
    • Environment variable JAVA_HOME or JDK_HOME
    • Note: The path should end at the parent folder that contains the bin folder. Example Path: /usr/lib/jvm/java-1.8.0 if bin exists at /usr/lib/jvm/java-1.8.0/bin.
    • Note: If the path is not set, the extension will attempt to find the path to the JDK or JRE.

See how to set java home for more information how this extension searches for Java.

Supported VS Code settings

The following settings are supported:

  • xml.java.home: Specifies the folder path to the JDK (8 or more recent) used to launch the XML Language Server if the Java server is being run. If not set, falls back to either the java.home preference or the JAVA_HOME or JDK_HOME environment variables.
  • xml.server.vmargs: Specifies extra VM arguments used to launch the XML Language Server. Eg. use -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication to bypass class verification, increase the heap size to 1GB and enable String deduplication with the G1 Garbage collector.
  • xml.server.workDir: Set a custom folder path for cached XML Schemas. An absolute path is expected, although the ~ prefix (for the user home directory) is supported. Default is ~/.lemminx.
  • xml.server.preferBinary: If this setting is enabled, a binary version of the server will be launched even if Java is installed.
  • xml.server.binary.path: Specify the path of a custom binary version of the XML server to use. A binary will be downloaded if this is not set.
  • xml.server.binary.args: Command line arguments to supply to the binary server when the binary server is being used. Takes into effect after relaunching VSCode. Please refer to this website for the available options. For example, you can increase the maximum memory that the server can use to 1 GB by adding -Xmx1g
  • xml.server.silenceExtensionWarning: If this setting is enabled, do not warn about launching the binary server when there are extensions to the XML language server installed.
  • xml.server.binary.trustedHashes: List of the SHA256 hashes of trusted copies of the lemminx (XML language server) binary.
  • xml.trace.server: Trace the communication between VS Code and the XML language server in the Output view. Default is off.
  • xml.logs.client: Enable/disable logging to the Output view. Default is true.
  • xml.catalogs: Register XML catalog files.
  • xml.downloadExternalResources.enabled: Download external resources like referenced DTD, XSD. Default is true.
  • xml.fileAssociations: Allows XML schemas/ DTD to be associated to file name patterns.
  • xml.foldings.includeClosingTagInFold: Minimize the closing tag after folding. Default is false.
  • xml.preferences.quoteStyle: Preferred quote style to use for completion: single quotes, double quotes. Default is double.
  • xml.autoCloseTags.enabled : Enable/disable autoclosing of XML tags. Default is true. IMPORTANT: The following settings must be turned of for this to work: editor.autoClosingTags, editor.autoClosingBrackets.
  • xml.codeLens.enabled: Enable/disable XML CodeLens. Default is false.
  • xml.preferences.showSchemaDocumentationType: Specifies the source of the XML schema documentation displayed on hover and completion. Default is all.
  • xml.validation.enabled: Enable/disable all validation. Default is true.
  • xml.validation.namespaces.enabled: Enable/disable namespaces validation. Default is always. Ignored if xml.validation.enabled is set to false.
  • xml.validation.schema.enabled: Enable/disable schema based validation. Default is always. Ignored if xml.validation.enabled is set to false.
  • xml.validation.disallowDocTypeDecl: Enable/disable if a fatal error is thrown if the incoming document contains a DOCTYPE declaration. Default is false.
  • xml.validation.resolveExternalEntities: Enable/disable resolve of external entities. Default is false. Disabled in untrusted workspace.
  • xml.validation.noGrammar: The message severity when a document has no associated grammar. Defaults to hint.
  • xml.validation.filters: Allows XML validation filter to be associated to file name patterns.
  • xml.symbols.enabled: Enable/disable document symbols (Outline). Default is true.
  • xml.symbols.excluded: Disable document symbols (Outline) for the given file name patterns. Updating file name patterns does not automatically reload the Outline view for the relevant file(s). Each file must either be reopened or changed, in order to trigger an Outline view reload.
  • xml.symbols.maxItemsComputed: The maximum number of outline symbols and folding regions computed (limited for performance reasons). Default is 5000.
  • xml.symbols.showReferencedGrammars: Show referenced grammars in the Outline. Default is true.
  • xml.symbols.filters: Allows XML symbols filter to be associated to file name patterns.
  • files.trimTrailingWhitespace: Now affects XML formatting. Enable/disable trailing whitespace trimming when formatting an XML document. Default is false.
  • See Formatting settings for a detailed list of the formatting settings.

Telemetry

With your approval, the vscode-xml extension collects anonymous usage data and sends it to Red Hat servers to help improve our products and services. Read our privacy statement to learn more. This extension respects the redhat.telemetry.enabled setting, which you can learn more about at https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting

LemMinX Binary

As a part of the release process, vscode-xml builds a binary version of the LemMinX XML Language Server. The stable releases of the binary, which are used in the vscode-xml releases, are available at https://download.jboss.org/jbosstools/vscode/stable/lemminx-binary/. The latest snapshot build of the binary, which tracks the HEAD of this repository, is available at https://download.jboss.org/jbosstools/vscode/snapshots/lemminx-binary/LATEST/.

Articles

Custom XML Extensions

The LemMinX - XML Language Server can be extended to support custom completion, hover, validation, rename, etc. Please see the extensions documentation for more information.

Contributing

This is an open source project open to anyone. Contributions are extremely welcome!

For information on getting started, refer to the CONTRIBUTING instructions.

Click on Switch to Pre-Release Version to enjoy the latest changes.

Switch to Pre-Release

Feedback

License

EPL 2.0, See LICENSE file.