-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented simple content-assist contributor for JDT that connects t…
…o an LS
- Loading branch information
1 parent
91a560b
commit a5e9f45
Showing
15 changed files
with
413 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
eclipse-language-servers/org.springframework.boot.ide.java.servers.feature/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin.includes = feature.xml |
21 changes: 21 additions & 0 deletions
21
eclipse-language-servers/org.springframework.boot.ide.java.servers.feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<feature | ||
id="org.springframework.boot.ide.java.servers.feature" | ||
label="Spring Boot IDE Java Editing Language Server Feature" | ||
version="4.0.0.qualifier" | ||
provider-name="Pivotal, Inc."> | ||
|
||
<requires> | ||
<import plugin="org.eclipse.ui.genericeditor"/> | ||
<import plugin="org.eclipse.lsp4e"/> | ||
</requires> | ||
|
||
<plugin | ||
id="org.springframework.boot.ide.java.servers" | ||
download-size="0" | ||
install-size="0" | ||
version="0.0.0" | ||
unpack="false"> | ||
</plugin> | ||
|
||
</feature> |
15 changes: 15 additions & 0 deletions
15
eclipse-language-servers/org.springframework.boot.ide.java.servers.feature/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot.ide</groupId> | ||
<artifactId>org.springframework.boot.ide.servers</artifactId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>org.springframework.boot.ide.java.servers.feature</artifactId> | ||
<packaging>eclipse-feature</packaging> | ||
|
||
</project> |
7 changes: 7 additions & 0 deletions
7
eclipse-language-servers/org.springframework.boot.ide.java.servers/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
28 changes: 28 additions & 0 deletions
28
eclipse-language-servers/org.springframework.boot.ide.java.servers/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.springframework.boot.ide.java.servers</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
7 changes: 7 additions & 0 deletions
7
...ge-servers/org.springframework.boot.ide.java.servers/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
21 changes: 21 additions & 0 deletions
21
eclipse-language-servers/org.springframework.boot.ide.java.servers/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Servers | ||
Bundle-SymbolicName: org.springframework.boot.ide.java.servers;singleton:=true | ||
Bundle-Version: 4.0.0.qualifier | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0", | ||
org.eclipse.core.runtime;bundle-version="3.12.0", | ||
org.eclipse.lsp4e;bundle-version="0.1.0", | ||
org.eclipse.ui.genericeditor;bundle-version="1.0.0", | ||
org.eclipse.jface.text;bundle-version="3.11.100", | ||
org.eclipse.jdt.ui;bundle-version="3.13.0", | ||
org.eclipse.lsp4j, | ||
org.eclipse.ui.workbench, | ||
org.eclipse.jface, | ||
org.eclipse.xtext.xbase.lib | ||
Import-Package: com.google.gson;version="2.7.0", | ||
org.eclipse.jface.preference, | ||
org.eclipse.lsp4j.jsonrpc.messages;version="0.1.0.v20170117-0759", | ||
org.eclipse.lsp4j.services;version="0.1.0.v20170117-0759", | ||
org.osgi.framework |
6 changes: 6 additions & 0 deletions
6
eclipse-language-servers/org.springframework.boot.ide.java.servers/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
plugin.xml,\ | ||
servers/ |
29 changes: 29 additions & 0 deletions
29
eclipse-language-servers/org.springframework.boot.ide.java.servers/plugin.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
|
||
<extension | ||
point="org.eclipse.lsp4e.languageServer"> | ||
<server | ||
class="org.springframework.boot.ide.java.servers.SpringBootJavaLanguageServer" | ||
id="org.eclipse.languageserver.languages.springbootjava" | ||
label="Spring Boot Java Language Server"> | ||
</server> | ||
<contentTypeMapping | ||
contentType="org.eclipse.jdt.core.javaSource" | ||
id="org.eclipse.languageserver.languages.springbootjava"> | ||
</contentTypeMapping> | ||
</extension> | ||
|
||
<extension | ||
id="springbootjava-completion-computer" | ||
point="org.eclipse.jdt.ui.javaCompletionProposalComputer"> | ||
<javaCompletionProposalComputer | ||
activate="true" | ||
categoryId="org.eclipse.jdt.ui.defaultProposalCategory" | ||
class="org.springframework.boot.ide.java.servers.SpringBootJavaCompletionProposalComputer" | ||
needsSortingAfterFiltering="false"> | ||
</javaCompletionProposalComputer> | ||
</extension> | ||
|
||
</plugin> |
56 changes: 56 additions & 0 deletions
56
eclipse-language-servers/org.springframework.boot.ide.java.servers/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot.ide</groupId> | ||
<artifactId>org.springframework.boot.ide.servers</artifactId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>org.springframework.boot.ide.java.servers</artifactId> | ||
<packaging>eclipse-plugin</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.ide.vscode</groupId> | ||
<artifactId>vscode-boot-java</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.10</version> | ||
<executions> | ||
<execution> | ||
<id>copy</id> | ||
<phase>prepare-package</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>org.springframework.ide.vscode</groupId> | ||
<artifactId>vscode-boot-java</artifactId> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.build.directory}/../servers</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
<overWriteReleases>true</overWriteReleases> | ||
<overWriteSnapshots>true</overWriteSnapshots> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
20 changes: 20 additions & 0 deletions
20
...mework.boot.ide.java.servers/src/org/springframework/boot/ide/java/servers/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Pivotal, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Pivotal, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springframework.boot.ide.java.servers; | ||
|
||
/** | ||
* @author Martin Lippert | ||
*/ | ||
public class Constants { | ||
|
||
public static final String PLUGIN_ID = "org.springframework.boot.ide.java.servers"; | ||
|
||
} |
64 changes: 64 additions & 0 deletions
64
...c/org/springframework/boot/ide/java/servers/SpringBootJavaCompletionProposalComputer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Pivotal, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Pivotal, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springframework.boot.ide.java.servers; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext; | ||
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer; | ||
import org.eclipse.jface.text.contentassist.ICompletionProposal; | ||
import org.eclipse.jface.text.contentassist.IContextInformation; | ||
import org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor; | ||
|
||
/** | ||
* @author Martin Lippert | ||
*/ | ||
@SuppressWarnings("restriction") | ||
public class SpringBootJavaCompletionProposalComputer implements IJavaCompletionProposalComputer { | ||
|
||
private LSContentAssistProcessor lsContentAssistProcessor; | ||
|
||
public SpringBootJavaCompletionProposalComputer() { | ||
lsContentAssistProcessor = new LSContentAssistProcessor(); | ||
} | ||
|
||
@Override | ||
public void sessionStarted() { | ||
} | ||
|
||
@Override | ||
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, | ||
IProgressMonitor monitor) { | ||
System.out.println("Spring Boot Java Completion Proposal - compute completion proposals"); | ||
|
||
ICompletionProposal[] proposals = lsContentAssistProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset()); | ||
return Arrays.asList(proposals); | ||
} | ||
|
||
@Override | ||
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, | ||
IProgressMonitor monitor) { | ||
IContextInformation[] contextInformation = lsContentAssistProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset()); | ||
return Arrays.asList(contextInformation); | ||
} | ||
|
||
@Override | ||
public String getErrorMessage() { | ||
return lsContentAssistProcessor.getErrorMessage(); | ||
} | ||
|
||
@Override | ||
public void sessionEnded() { | ||
} | ||
|
||
} |
Oops, something went wrong.