Ⅰ. 插件描述
XML Language ServerⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'angelozerr/lsp4xml'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'angelozerr/lsp4xml'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'angelozerr/lsp4xml'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/angelozerr/lsp4xml
Ⅳ. 文档说明
XML Language Server (LemMinX)
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
- textDocument/codeAction.
- textDocument/completion.
- textDocument/documentHighlight.
- textDocument/documentLink.
- textDocument/documentSymbol.
- textDocument/foldingRanges.
- textDocument/formatting.
- textDocument/hover.
- textDocument/rangeFormatting
- textDocument/rename.
See screenshots in the wiki.
See the changelog for the latest release.
Extension
The XML Language Server is extensible with plugin kind (with SPI). Here existings extensions:
- content model to provide completion, validation, hover based on XML Schema.
- emmet to provide completion based on Emmet.
Demo

Get started
- Clone this repository
- Open the folder in your terminal / command line
- Run
./mvnw clean verify(OSX, Linux) ormvnw.cmd clean verify(Windows) - After successful compilation you can find the resulting
org.eclipse.lemminx-uber.jarin the folderorg.eclipse.lemminx/target
Developer
To debug the XML LS you can use XMLServerSocketLauncher:
- Run the XMLServerSocketLauncher in debug mode (e.g. in eclipse)
- Connect your client via socket port. Default port is 5008, but you can change it with start argument
--portin 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.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://dl.bintray.com/lemminx/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>or P2 repository: https://dl.bintray.com/lemminx/p2/<VERSION>
And if you want to consume the SNAPSHOT builds instead:
<repository>
<id>lemminx-snapshots</id>
<url>https://oss.jfrog.org/artifactory/libs-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>or P2 repository:
https://lemminx.jfrog.io/lemminx/generic-local/p2/lemminx/<VERSION>
Clients
Here are some clients consuming this XML Language Server:
- Eclipse IDE with Wild Web Developer
- VSCode with vscode-xml
- Theia with theia-xml
- Spring Tools 4 - re-using the XML parser for Spring-specific analysis and content-assist
- Vim/Neovim with coc-xml
---
