Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to lemminx. #227

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ Contributions are essential for keeping this extension great. We try to keep it
### Steps
1. Fork and clone this repository

2. Fork and clone the [XML Language Server (lsp4xml)](https://github.com/angelozerr/lsp4xml)
2. Fork and clone the [LemMinX - XML Language Server ](https://github.com/eclipse/lemminx)

* **Note:** The directory format has to match the following:

```
YOUR_FOLDER/
├──── lsp4xml/
├──── lemminx/
├──── vscode-xml/
```

3. `cd lsp4xml/`
3. `cd lemminx/`

4. Install the maven dependencies Mac/Linux:
```bash
Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def buildVscodeExtension(){

node('rhel7'){
stage 'Build XML LS'
git url: 'https://github.com/angelozerr/lsp4xml.git'
sh "./mvnw clean verify -B -U -e -pl \"!extensions,!extensions/org.eclipse.lsp4xml.extensions.emmet,!extensions/org.eclipse.lsp4xml.extensions.web\" -P!jboss-maven-repos,!redhat-ga-repository,!redhat-ea-repository"
git url: 'https://github.com/eclipse/lemminx.git'
sh "./mvnw clean verify -B -U -e -P!jboss-maven-repos,!redhat-ga-repository,!redhat-ea-repository"

def files = findFiles(glob: '**/org.eclipse.lsp4xml/target/org.eclipse.lsp4xml-uber.jar')
def files = findFiles(glob: '**/org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar')
stash name: 'server_distro', includes :files[0].path
}

Expand All @@ -34,7 +34,7 @@ node('rhel7'){
stage 'Build vscode-xml'
buildVscodeExtension()
unstash 'server_distro'
def files = findFiles(glob: '**/org.eclipse.lsp4xml/target/org.eclipse.lsp4xml-uber.jar')
def files = findFiles(glob: '**/org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar')
sh "mkdir ./server"
sh "mv ${files[0].path} ./server"

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Description

This VS Code extension provides support for creating and editing XML documents, based on the [LSP4XML Language Server](https://github.com/angelozerr/lsp4xml), running with Java.
This VS Code extension provides support for creating and editing XML documents, based on the [LemMinX XML Language Server](https://github.com/eclipse/lemminx), running with Java.

![Basic features](https://user-images.githubusercontent.com/148698/45977901-df208a80-c018-11e8-85ec-71c70ba8a5ca.gif)

Expand Down Expand Up @@ -72,20 +72,20 @@ The following settings are supported:
* `xml.validation.noGrammar`: The message severity when a document has no associated grammar. Defaults to `hint`.
* `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`.
* `xml.server.workDir`: Set an absolute path for all cached schemas to be stored. Defaults to `~/.lsp4xml`.
* `xml.server.workDir`: Set an absolute path for all cached schemas to be stored. Defaults to `~/.lemminx`.
* `xml.codeLens.enabled`: Enable/disable XML CodeLens. Default is `false`.
* `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.

## Custom XML Extensions

The [LSP4XML Language Server](https://github.com/angelozerr/lsp4xml) can be extended to support custom completion, hover, validation, rename, etc by using the [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-spi) mechanism. vscode-xml provides the ability use your custom XML support provider, by adding external jars to the XML language server's classpath.
The [LemMinX - XML Language Server](https://github.com/eclipse/lemminx) can be extended to support custom completion, hover, validation, rename, etc by using the [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-spi) mechanism. vscode-xml provides the ability use your custom XML support provider, by adding external jars to the XML language server's classpath.

To do that:

* create a Java project which provides a custom XML extension providing your custom completion, hover, validation, rename, etc:
* create the XML extension like [MavenPlugin](https://github.com/angelozerr/lsp4xml-extensions-maven/blob/master/org.eclipse.lsp4xml.extensions.maven/src/main/java/org/eclipse/lsp4xml/extensions/maven/MavenPlugin.java).
* register your custom completion participant in the XML extension like [MavenCompletionParticipant](https://github.com/angelozerr/lsp4xml-extensions-maven/blob/master/org.eclipse.lsp4xml.extensions.maven/src/main/java/org/eclipse/lsp4xml/extensions/maven/MavenCompletionParticipant.java#L28)
* register your custom XML extension with [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-spi) mechanism in the [/META-INF/services/org.eclipse.lsp4xml.services.extensions.IXMLExtension](https://github.com/angelozerr/lsp4xml-extensions-maven/blob/master/org.eclipse.lsp4xml.extensions.maven/src/main/resources/META-INF/services/org.eclipse.lsp4xml.services.extensions.IXMLExtension) file.
* register your custom XML extension with [Java Service Provider Interface (SPI)](https://www.baeldung.com/java-spi) mechanism in the [/META-INF/services/org.eclipse.lemminx.services.extensions.IXMLExtension](https://github.com/angelozerr/lsp4xml-extensions-maven/blob/master/org.eclipse.lsp4xml.extensions.maven/src/main/resources/META-INF/services/org.eclipse.lsp4xml.services.extensions.IXMLExtension) file.
* build a JAR `your-custom-xml-extension.jar`.

* create a `vscode extension` which embeds the `your-custom-xml-extension.jar` JAR and declares this JAR path in the `package.json`:
Expand Down
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const gulp = require('gulp');
const gulp_tslint = require('gulp-tslint');
const cp = require('child_process');
const server_dir = '../lsp4xml';
const server_dir = '../lemminx';

gulp.task('tslint', () => {
return gulp.src(['**/*.ts', '!**/*.d.ts', '!node_modules/**'])
Expand All @@ -11,8 +11,8 @@ gulp.task('tslint', () => {
});

gulp.task('build_server', function(done) {
cp.execSync(mvnw()+ " -o clean verify -DskipTests -pl \"!extensions,!extensions/org.eclipse.lsp4xml.extensions.emmet,!extensions/org.eclipse.lsp4xml.extensions.web\"", {cwd:server_dir, stdio:[0,1,2]} );
gulp.src(server_dir +'/org.eclipse.lsp4xml/target/org.eclipse.lsp4xml-uber.jar')
cp.execSync(mvnw()+ " -o clean verify -DskipTests", {cwd:server_dir, stdio:[0,1,2]} );
gulp.src(server_dir +'/org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar')
.pipe(gulp.dest('./server'));
done();
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
},
"xml.server.workDir": {
"type": "string",
"default": "~/.lsp4xml",
"default": "~/.lemminx",
"description": "Set a custom folder path for cached XML Schemas. An absolute path is expected, although the ~ prefix (for the user home directory) is supported.",
"scope": "window"
},
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ namespace TagCloseRequest {
export function activate(context: ExtensionContext) {
let storagePath = context.storagePath;
if (!storagePath) {
storagePath = os.homedir() + "/.lsp4xml";
storagePath = os.homedir() + "/.lemminx";
}
let logfile = path.resolve(storagePath + '/lsp4xml.log');
let logfile = path.resolve(storagePath + '/lemminx.log');

return requirements.resolveRequirements(context).catch(error => {
//show error
Expand Down
4 changes: 2 additions & 2 deletions src/javaServerStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ function prepareParams(requirements: RequirementsData, xmlJavaExtensions: string
}
parseVMargs(params, vmargs);
let server_home: string = path.resolve(__dirname, '../server');
let launchersFound: Array<string> = glob.sync('**/org.eclipse.lsp4xml-uber.jar', { cwd: server_home });
let launchersFound: Array<string> = glob.sync('**/org.eclipse.lemminx-uber.jar', { cwd: server_home });
if (launchersFound.length) {
let xmlJavaExtensionsClasspath = '';
if (xmlJavaExtensions.length > 0) {
const pathSeparator = os.platform() == 'win32' ? ';' : ':';
xmlJavaExtensionsClasspath = pathSeparator + xmlJavaExtensions.join(pathSeparator);
}
params.push('-cp'); params.push(path.resolve(server_home, launchersFound[0]) + xmlJavaExtensionsClasspath);
params.push('org.eclipse.lsp4xml.XMLServerLauncher');
params.push('org.eclipse.lemminx.XMLServerLauncher');
} else {
return null;
}
Expand Down