a1dutch / lemminx

XML Language Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XML Language Server (LemMinX)

Build Status

LemMinX is a XML language specific implementation of the Language Server Protocol and can be used with any editor that supports the protocol, to offer good support for the XML Language. The server is based on:

  • Eclipse LSP4J, the Java binding for the Language Server Protocol.
  • Xerces to manage XML Schema validation, completion and hover

Features

See screenshots in the wiki.

See the changelog for the latest release.

Demo

XML Language Server Demo

Get started

  • Clone this repository
  • Open the folder in your terminal / command line
  • Run ./mvnw clean verify (OSX, Linux) or mvnw.cmd clean verify (Windows)
  • After successful compilation you can find the resulting org.eclipse.lemminx-uber.jar in the folder org.eclipse.lemminx/target

Developer

To debug the XML LS you can use XMLServerSocketLauncher:

  1. Run the XMLServerSocketLauncher in debug mode (e.g. in eclipse)
  2. Connect your client via socket port. Default port is 5008, but you can change it with start argument --port in step 1

Client connection example using Theia and TypeScript:

let socketPort = '5008'
console.log(`Connecting via port ${socketPort}`)
const socket = new net.Socket()
const serverConnection = createSocketConnection(socket,
    socket, () => {
        socket.destroy()
    });
this.forward(clientConnection, serverConnection)
socket.connect(socketPort)

Maven coordinates:

Here are the Maven coordinates for lemminx (replace the X.Y.Z version with the latest release):

<dependency>
    <groupId>org.eclipse.lemminx</groupId>
    <artifactId>org.eclipse.lemminx</artifactId>
    <version>X.Y.Z</version>
    <!-- classifier:uber includes all dependencies -->
    <classifier>uber</classifier>
</dependency>

for Gradle:

compile(group: 'org.lemminx', name: 'org.eclipse.lemminx', version: 'X.Y.Z', classifier: 'uber')

You will have to reference the Maven repository hosting the dependency you need. E.g. for Maven, add this repository to your pom.xml or settings.xml :

<repository>
  <id>lemminx-releases</id>
  <url>https://repo.eclipse.org/content/repositories/lemminx-releases/</url>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <releases>
    <enabled>true</enabled>
  </releases>
</repository>

And if you want to consume the SNAPSHOT builds instead:

<repository>
  <id>lemminx-snapshots</id>
  <url>https://repo.eclipse.org/content/repositories/lemminx-snapshots/</url>
  <releases>
    <enabled>false</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>

Clients

Here are some clients consuming this XML Language Server:

Extensions

The XML Language Server is extensible with plugin kind (with SPI). Additionally to XSD-based validation and assistance, those extensiosn allow to enrich the validation and assistance, typically for specific files or contexts.

Example of extensions include:

  • Built-in content model to provide completion, validation, hover based on XML Schema.
  • Built-in completion based on Emmet
  • See all built-in extensions
  • Eclipse LemMinX Maven extension provides extra assistance for Maven pom files, adding some pom validation (as diagnostics), hover for documentation and properties evaluation, completion for configuration element (not part of XSD), constrained node, file path, GAVs..., go to definition for properties and GAVs...
  • LemMinX Liquibase extension provides extra assistance for Liquibase XML migration scripts, adding database validation (as diagnostics) using an in-memory database.

About

XML Language Server

License:Eclipse Public License 2.0


Languages

Language:Java 100.0%