Giter Site home page Giter Site logo

lemminx's Introduction

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 Features docs.

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)

Generating a native binary:

To generate a native binary:

  • Install GraalVM 20.2.0
  • In a terminal, run gu install native-image
  • Execute a Maven build that sets the flag native: ./mvnw clean package -Dnative -DskipTests
    • On Linux, compile with ./mvnw clean package -Dnative -DskipTests -Dgraalvm.static=--static in order to support distributions that don't use glibc, such as Alpine Linux
  • It will generate a native binary in org.eclipse.lemminx/target/lemminx-{os.name}-{architecture}-{version}

OS specific instructions:

  • Linux:
    • Make sure that you have installed the static versions of the C++ standard library
      • For instance, on Fedora Linux, install glibc-static, libstdc++-static, and zlib-static
  • Windows:
    • When installing native-image, please note that gu is an existing alias in PowerShell. Remove the alias with Remove-Item alias:gu -Force, refer to gu with the absolute path, or use gu under cmd.exe.
    • Make sure to run the Maven wrapper in the "Native Tools Command Prompt". This command prompt can be obtained through installing the Windows SDK or Visual Studio, as mentioned in the GraalVM installation instructions.

native-image Development Instructions:

  • Reflection:
    • If you need to use reflection to access a private field/method, simply register the field/methods that you access in reflect-config.json
    • If you need to parse some JSON using Gson, make sure to register the fields and methods of the class that you are parsing into in reflect-config.json
      • This needs to be done recursively, for all classes that it has member variables of, including enums
      • Settings are all deserialized, so whenever a setting is added, make sure to register the classes
    • Manually test the binary and check the logs for reflection errors/NPEs

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>

Verify 3rd Party Libraries

Currently generating the IP Log report requires a Java Runtime Environment (JRE) >= 11.

Run ./mvnw clean verify -Pverify-iplog to generate a report for the 3rd party libraries used by this project. See the Eclipse Project Handbook for further details.

Clients

Here are some clients consuming this XML Language Server:

Extensions

The XML Language Server can be extended to provide additional validation and assistance. Read the LemMinX-Extensions docs for more information

lemminx's People

Contributors

angelozerr avatar fbricon avatar nikolaskomonen avatar datho7561 avatar dkwon17 avatar eclipse-lemminx-bot avatar rgrunber avatar mickaelistria avatar snjeza avatar yashtef avatar aobuchow avatar balduinlandolt avatar dhuebner avatar seiphon avatar dependabot[bot] avatar rzgry avatar gitmensch avatar anthonyvdotbe avatar apupier avatar boykoalex avatar chaseknowlden avatar felixfbecker avatar fannheyward avatar yyoncho avatar jonburs avatar martinlippert avatar jdneo avatar zewa666 avatar yatli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.