A map entry (key-value pair). The
Map.entrySet method returns",
@@ -272,7 +272,7 @@ public class HtmlJavadocTest {
public void html_testNoJavadocClass() throws Exception {
MavenJavaProject project = projectSupplier.get();;
- IType type = project.findType("hello.GreetingController");
+ IType type = project.getClasspath().findType("hello.GreetingController");
assertNotNull(type);
assertNull(type.getJavaDoc());
}
@@ -281,7 +281,7 @@ public class HtmlJavadocTest {
public void html_testNoJavadocField() throws Exception {
MavenJavaProject project = projectSupplier.get();
- IType type = project.findType("hello.GreetingController");
+ IType type = project.getClasspath().findType("hello.GreetingController");
assertNotNull(type);
IField field = type.getField("template");
assertNotNull(field);
@@ -302,7 +302,7 @@ public class HtmlJavadocTest {
public void html_testNoJavadocMethod() throws Exception {
MavenJavaProject project = projectSupplier.get();
- IType type = project.findType("hello.Application");
+ IType type = project.getClasspath().findType("hello.Application");
assertNotNull(type);
IMethod method = type.getMethod("corsConfigurer", Stream.empty());
assertNotNull(method);
diff --git a/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/JavaIndexTest.java b/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/JavaIndexTest.java
index d443adb4f..0fe710e24 100644
--- a/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/JavaIndexTest.java
+++ b/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/JavaIndexTest.java
@@ -45,7 +45,7 @@ public class JavaIndexTest {
public MavenJavaProject load(String projectName) throws Exception {
Path testProjectPath = Paths.get(DependencyTreeTest.class.getResource("/" + projectName).toURI());
MavenBuilder.newBuilder(testProjectPath).clean().pack().javadoc().skipTests().execute();
- return new MavenJavaProject(testProjectPath.resolve(MavenCore.POM_XML).toFile());
+ return new MavenJavaProject(MavenCore.getDefault(), testProjectPath.resolve(MavenCore.POM_XML).toFile());
}
});
@@ -83,28 +83,28 @@ public class JavaIndexTest {
@Test
public void findClassInJar() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
- IType type = project.findType("org.springframework.test.web.client.ExpectedCount");
+ IType type = project.getClasspath().findType("org.springframework.test.web.client.ExpectedCount");
assertNotNull(type);
}
@Test
public void findClassInOutputFolder() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
- IType type = project.findType("hello.Greeting");
+ IType type = project.getClasspath().findType("hello.Greeting");
assertNotNull(type);
}
@Test
public void classNotFound() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
- IType type = project.findType("hello.NonExistentClass");
+ IType type = project.getClasspath().findType("hello.NonExistentClass");
assertNull(type);
}
@Test
public void voidMethodNoParams() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
- IType type = project.findType("java.util.ArrayList");
+ IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("clear", Stream.empty());
assertEquals("clear", m.getElementName());
@@ -115,7 +115,7 @@ public class JavaIndexTest {
@Test
public void voidConstructor() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
- IType type = project.findType("java.util.ArrayList");
+ IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("
", Stream.empty());
assertEquals(type.getElementName(), m.getElementName());
@@ -126,7 +126,7 @@ public class JavaIndexTest {
@Test
public void constructorMethodWithParams() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
- IType type = project.findType("java.util.ArrayList");
+ IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("", Stream.of(IPrimitiveType.INT));
assertEquals(m.getDeclaringType().getElementName(), m.getElementName());
diff --git a/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/SourceJavadocTest.java b/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/SourceJavadocTest.java
index f196b9d37..cffcb6301 100644
--- a/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/SourceJavadocTest.java
+++ b/vscode-extensions/commons/commons-maven/src/test/java/org/springframework/ide/vscode/commons/maven/SourceJavadocTest.java
@@ -19,12 +19,12 @@ import java.nio.file.Paths;
import java.util.stream.Stream;
import org.junit.Test;
+import org.springframework.ide.vscode.commons.jandex.JandexClasspath;
+import org.springframework.ide.vscode.commons.jandex.JandexClasspath.JavadocProviderTypes;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IMethod;
import org.springframework.ide.vscode.commons.java.IType;
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
-import org.springframework.ide.vscode.commons.maven.java.MavenProjectClasspath;
-import org.springframework.ide.vscode.commons.maven.java.MavenProjectClasspath.JavadocProviderTypes;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
@@ -34,9 +34,9 @@ public class SourceJavadocTest {
private static Supplier projectSupplier = Suppliers.memoize(() -> {
Path testProjectPath;
try {
- MavenProjectClasspath.providerType = JavadocProviderTypes.JAVA_PARSER;
+ JandexClasspath.providerType = JavadocProviderTypes.JAVA_PARSER;
testProjectPath = Paths.get(SourceJavadocTest.class.getResource("/gs-rest-service-cors-boot-1.4.1-with-classpath-file").toURI());
- return new MavenJavaProject(testProjectPath.resolve(MavenCore.POM_XML).toFile());
+ return new MavenJavaProject(MavenCore.getDefault(), testProjectPath.resolve(MavenCore.POM_XML).toFile());
} catch (Exception e) {
return null;
}
@@ -46,7 +46,7 @@ public class SourceJavadocTest {
public void parser_testClassJavadocForJar() throws Exception {
MavenJavaProject project = projectSupplier.get();
- IType type = project.findType("org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener");
+ IType type = project.getClasspath().findType("org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener");
assertNotNull(type);
String expected = String.join("\n",
"/**",
@@ -54,7 +54,7 @@ public class SourceJavadocTest {
);
assertEquals(expected, type.getJavaDoc().raw().trim().substring(0, expected.length()));
- type = project.findType("org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener$LiquibasePresent");
+ type = project.getClasspath().findType("org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener$LiquibasePresent");
assertNotNull(type);
expected = String.join("\n",
"/**",
@@ -67,7 +67,7 @@ public class SourceJavadocTest {
@Test
public void parser_testClassJavadocForOutputFolder() throws Exception {
MavenJavaProject project = projectSupplier.get();
- IType type = project.findType("hello.Greeting");
+ IType type = project.getClasspath().findType("hello.Greeting");
assertNotNull(type);
String expected = String.join("\n",
@@ -100,7 +100,7 @@ public class SourceJavadocTest {
public void parser_testFieldAndMethodJavadocForJar() throws Exception {
MavenJavaProject project = projectSupplier.get();
- IType type = project.findType("org.springframework.boot.SpringApplication");
+ IType type = project.getClasspath().findType("org.springframework.boot.SpringApplication");
assertNotNull(type);
IField field = type.getField("BANNER_LOCATION_PROPERTY_VALUE");
@@ -124,7 +124,7 @@ public class SourceJavadocTest {
@Test
public void parser_testInnerClassJavadocForOutputFolder() throws Exception {
MavenJavaProject project = projectSupplier.get();
- IType type = project.findType("hello.Greeting$TestInnerClass");
+ IType type = project.getClasspath().findType("hello.Greeting$TestInnerClass");
assertNotNull(type);
assertEquals("/**\n * Comment for inner class\n */", type.getJavaDoc().raw().trim());
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/util/FuzzyMap.java b/vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/FuzzyMap.java
similarity index 98%
rename from vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/util/FuzzyMap.java
rename to vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/FuzzyMap.java
index ac551346f..4df5f91a9 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/util/FuzzyMap.java
+++ b/vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/FuzzyMap.java
@@ -8,7 +8,7 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
-package org.springframework.ide.vscode.boot.metadata.util;
+package org.springframework.ide.vscode.commons.util;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/FuzzyMapTest.java b/vscode-extensions/commons/commons-util/src/test/java/org/springframework/ide/vscode/commons/util/FuzzyMapTest.java
similarity index 93%
rename from vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/FuzzyMapTest.java
rename to vscode-extensions/commons/commons-util/src/test/java/org/springframework/ide/vscode/commons/util/FuzzyMapTest.java
index 0d5f9d812..8ceac034e 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/FuzzyMapTest.java
+++ b/vscode-extensions/commons/commons-util/src/test/java/org/springframework/ide/vscode/commons/util/FuzzyMapTest.java
@@ -8,18 +8,17 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
-package org.springframework.ide.vscode.boot.metadata;
+package org.springframework.ide.vscode.commons.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.junit.Test;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap.Match;
-import org.springframework.ide.vscode.commons.util.FuzzyMatcher;
+import org.springframework.ide.vscode.commons.util.FuzzyMap.Match;
public class FuzzyMapTest {
diff --git a/vscode-extensions/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/LanguageServerHarness.java b/vscode-extensions/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/LanguageServerHarness.java
index 812ab72cd..dc1e8e8dd 100644
--- a/vscode-extensions/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/LanguageServerHarness.java
+++ b/vscode-extensions/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/LanguageServerHarness.java
@@ -302,6 +302,7 @@ public class LanguageServerHarness {
TextDocumentPositionParams params = new TextDocumentPositionParams();
params.setPosition(cursor);
params.setTextDocument(doc.getId());
+ server.waitForReconcile();
return server.getTextDocumentService().completion(params).get();
}
diff --git a/vscode-extensions/commons/pom.xml b/vscode-extensions/commons/pom.xml
index 43dbed3a4..a3ccd0ed5 100644
--- a/vscode-extensions/commons/pom.xml
+++ b/vscode-extensions/commons/pom.xml
@@ -18,8 +18,7 @@
java-properties
commons-cf
commons-maven
-
-
+ commons-gradle
@@ -73,13 +72,13 @@
1.17
4.11
3.5.2
- 1.7.21
+ 1.7.22
19.0
2.5.0
2.10
0.1.0
- 3.0.4.RELEASE
+ 3.0.5.RELEASE
0.6.0.RELEASE
2.4.0.BUILD-SNAPSHOT
diff --git a/vscode-extensions/vscode-boot-java/lib/Main.ts b/vscode-extensions/vscode-boot-java/lib/Main.ts
index 62c553daf..944b0ca6d 100644
--- a/vscode-extensions/vscode-boot-java/lib/Main.ts
+++ b/vscode-extensions/vscode-boot-java/lib/Main.ts
@@ -19,7 +19,7 @@ export function activate(context: VSCode.ExtensionContext) {
let options: commons.ActivatorOptions = {
DEBUG: false,
- CONNECT_TO_LS: true,
+ CONNECT_TO_LS: false,
extensionId: 'vscode-boot-java',
fatJarFile: 'target/vscode-boot-java-0.0.1-SNAPSHOT.jar',
clientOptions: {
diff --git a/vscode-extensions/vscode-boot-java/pom.xml b/vscode-extensions/vscode-boot-java/pom.xml
index 4457b0e29..de3f34aba 100644
--- a/vscode-extensions/vscode-boot-java/pom.xml
+++ b/vscode-extensions/vscode-boot-java/pom.xml
@@ -4,14 +4,14 @@
4.0.0
vscode-boot-java
jar
-
+
org.springframework.ide.vscode
commons-parent
0.0.1-SNAPSHOT
../commons/pom.xml
-
+
@@ -23,7 +23,7 @@
-
+
distribution-repository
@@ -31,19 +31,24 @@
file://${basedir}/dist
-
+
org.springframework.ide.vscode
commons-maven
${project.version}
+
+ org.springframework.ide.vscode
+ commons-gradle
+ ${project.version}
+
org.springframework.ide.vscode
commons-language-server
${project.version}
-
+
org.eclipse.jdt
@@ -57,6 +62,12 @@
2.4
+
+ org.springframework.boot
+ spring-boot-configuration-metadata
+ 1.5.1.RELEASE
+
+
org.springframework.ide.vscode
@@ -64,7 +75,7 @@
${project.version}
test
-
+
@@ -102,6 +113,6 @@
-
+
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java
index 59e1abd98..94c306f0b 100644
--- a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServer.java
@@ -15,15 +15,21 @@ import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.TextDocumentSyncKind;
import org.springframework.ide.vscode.boot.java.completions.BootJavaCompletionEngine;
import org.springframework.ide.vscode.boot.java.completions.BootJavaReconcileEngine;
+import org.springframework.ide.vscode.boot.java.hover.BootJavaHoverProvider;
+import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
+import org.springframework.ide.vscode.commons.gradle.GradleCore;
+import org.springframework.ide.vscode.commons.gradle.GradleProjectFinderStrategy;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionEngine;
import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter;
import org.springframework.ide.vscode.commons.languageserver.java.DefaultJavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.java.IJavaProjectFinderStrategy;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
+import org.springframework.ide.vscode.commons.languageserver.util.HoverHandler;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
import org.springframework.ide.vscode.commons.maven.JavaProjectWithClasspathFileFinderStrategy;
+import org.springframework.ide.vscode.commons.maven.MavenCore;
import org.springframework.ide.vscode.commons.maven.MavenProjectFinderStrategy;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
@@ -35,15 +41,14 @@ import org.springframework.ide.vscode.commons.util.text.TextDocument;
public class BootJavaLanguageServer extends SimpleLanguageServer {
public static final JavaProjectFinder DEFAULT_PROJECT_FINDER = new DefaultJavaProjectFinder(new IJavaProjectFinderStrategy[] {
- new MavenProjectFinderStrategy(),
+ new MavenProjectFinderStrategy(MavenCore.getDefault()),
+ new GradleProjectFinderStrategy(GradleCore.getDefault()),
new JavaProjectWithClasspathFileFinderStrategy()
});
- private final JavaProjectFinder javaProjectFinder;
private final VscodeCompletionEngineAdapter completionEngine;
- public BootJavaLanguageServer(JavaProjectFinder javaProjectFinder) {
- this.javaProjectFinder = javaProjectFinder;
+ public BootJavaLanguageServer(JavaProjectFinder javaProjectFinder, SpringPropertyIndexProvider indexProvider) {
SimpleTextDocumentService documents = getTextDocumentService();
IReconcileEngine reconcileEngine = new BootJavaReconcileEngine();
@@ -52,11 +57,14 @@ public class BootJavaLanguageServer extends SimpleLanguageServer {
validateWith(doc, reconcileEngine);
});
- ICompletionEngine bootCompletionEngine = new BootJavaCompletionEngine(javaProjectFinder);
+ ICompletionEngine bootCompletionEngine = new BootJavaCompletionEngine(javaProjectFinder, indexProvider);
completionEngine = new VscodeCompletionEngineAdapter(this, bootCompletionEngine);
completionEngine.setMaxCompletionsNumber(100);
documents.onCompletion(completionEngine::getCompletions);
documents.onCompletionResolve(completionEngine::resolveCompletion);
+
+ HoverHandler hoverInfoProvider = new BootJavaHoverProvider(this, javaProjectFinder);
+ documents.onHover(hoverInfoProvider);
}
public void setMaxCompletionsNumber(int number) {
@@ -71,6 +79,7 @@ public class BootJavaLanguageServer extends SimpleLanguageServer {
CompletionOptions completionProvider = new CompletionOptions();
completionProvider.setResolveProvider(false);
c.setCompletionProvider(completionProvider);
+ c.setHoverProvider(true);
return c;
}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/Main.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/Main.java
index d8b545050..a1a5664de 100644
--- a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/Main.java
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/Main.java
@@ -12,6 +12,7 @@ package org.springframework.ide.vscode.boot.java;
import java.io.IOException;
+import org.springframework.ide.vscode.boot.metadata.DefaultSpringPropertyIndexProvider;
import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
@@ -26,7 +27,8 @@ public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
LaunguageServerApp.start(() -> {
JavaProjectFinder javaProjectFinder = BootJavaLanguageServer.DEFAULT_PROJECT_FINDER;
- SimpleLanguageServer server = new BootJavaLanguageServer(javaProjectFinder);
+ DefaultSpringPropertyIndexProvider indexProvider = new DefaultSpringPropertyIndexProvider(javaProjectFinder);
+ SimpleLanguageServer server = new BootJavaLanguageServer(javaProjectFinder, indexProvider);
return server;
});
}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/BootJavaCompletionEngine.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/BootJavaCompletionEngine.java
index 8d20b070c..6411c5e39 100644
--- a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/BootJavaCompletionEngine.java
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/BootJavaCompletionEngine.java
@@ -25,6 +25,7 @@ import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.NodeFinder;
+import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
import org.springframework.ide.vscode.commons.java.IClasspath;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionEngine;
@@ -38,11 +39,14 @@ import org.springframework.ide.vscode.commons.util.text.IDocument;
public class BootJavaCompletionEngine implements ICompletionEngine {
private static final String SPRING_SCOPE = "org.springframework.context.annotation.Scope";
+ private static final String SPRING_VALUE = "org.springframework.beans.factory.annotation.Value";
private JavaProjectFinder projectFinder;
+ private SpringPropertyIndexProvider indexProvider;
- public BootJavaCompletionEngine(JavaProjectFinder projectFinder) {
+ public BootJavaCompletionEngine(JavaProjectFinder projectFinder, SpringPropertyIndexProvider indexProvider) {
this.projectFinder = projectFinder;
+ this.indexProvider = indexProvider;
}
@Override
@@ -105,6 +109,9 @@ public class BootJavaCompletionEngine implements ICompletionEngine {
if (type.getQualifiedName().equals(SPRING_SCOPE)) {
new ScopeCompletionProcessor().collectCompletionsForScopeAnnotation(node, annotation, type, completions, offset, doc);
}
+ else if (type.getQualifiedName().equals(SPRING_VALUE)) {
+ new ValueCompletionProcessor(indexProvider.getIndex(doc)).collectCompletionsForValueAnnotation(node, annotation, type, completions, offset, doc);
+ }
}
private String[] getClasspathEntries(IDocument doc) throws Exception {
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/ValueCompletionProcessor.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/ValueCompletionProcessor.java
new file mode 100644
index 000000000..f0bfa5194
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/ValueCompletionProcessor.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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.ide.vscode.boot.java.completions;
+
+import static org.springframework.ide.vscode.commons.util.StringUtil.camelCaseToHyphens;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
+import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
+import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
+import org.springframework.ide.vscode.commons.util.BadLocationException;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.FuzzyMap.Match;
+import org.springframework.ide.vscode.commons.util.text.IDocument;
+
+/**
+ * @author Martin Lippert
+ */
+public class ValueCompletionProcessor {
+
+ private FuzzyMap index;
+
+ public ValueCompletionProcessor(FuzzyMap index) {
+ this.index = index;
+ }
+
+ public void collectCompletionsForValueAnnotation(ASTNode node, Annotation annotation, ITypeBinding type,
+ List completions, int offset, IDocument doc) {
+
+ try {
+ // case: @Value(<*>)
+ if (node == annotation && doc.get(offset - 1, 2).endsWith("()")) {
+ List> matches = findMatches("");
+
+ for (Match match : matches) {
+
+ DocumentEdits edits = new DocumentEdits(doc);
+ edits.replace(offset, offset, "\"${" + match.data.getId() + "}\"");
+
+ ValuePropertyKeyProposal proposal = new ValuePropertyKeyProposal(edits, match.data.getId(), match.data.getName(), null);
+ completions.add(proposal);
+ }
+ }
+ // case: @Value(prefix<*>)
+ else if (node instanceof SimpleName && node.getParent() instanceof Annotation) {
+ computeProposalsForSimpleName(node, completions, offset, doc);
+ }
+ // case: @Value(value=<*>)
+ else if (node instanceof SimpleName && node.getParent() instanceof MemberValuePair
+ && "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
+ computeProposalsForSimpleName(node, completions, offset, doc);
+ }
+ // case: @Value("prefix<*>")
+ else if (node instanceof StringLiteral && node.getParent() instanceof Annotation) {
+ if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
+ computeProposalsForStringLiteral(node, completions, offset, doc);
+ }
+ }
+ // case: @Value(value="prefix<*>")
+ else if (node instanceof StringLiteral && node.getParent() instanceof MemberValuePair
+ && "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
+ if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
+ computeProposalsForStringLiteral(node, completions, offset, doc);
+ }
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void computeProposalsForSimpleName(ASTNode node, List completions, int offset,
+ IDocument doc) {
+ String prefix = identifyPropertyPrefix(node.toString(), offset - node.getStartPosition());
+
+ int startOffset = node.getStartPosition();
+ int endOffset = node.getStartPosition() + node.getLength();
+
+ String proposalPrefix = "\"";
+ String proposalPostfix = "\"";
+
+ List> matches = findMatches(prefix);
+
+ for (Match match : matches) {
+
+ DocumentEdits edits = new DocumentEdits(doc);
+ edits.replace(startOffset, endOffset, proposalPrefix + "${" + match.data.getId() + "}" + proposalPostfix);
+
+ ValuePropertyKeyProposal proposal = new ValuePropertyKeyProposal(edits, match.data.getId(), match.data.getName(), null);
+ completions.add(proposal);
+ }
+ }
+
+ private void computeProposalsForStringLiteral(ASTNode node, List completions, int offset,
+ IDocument doc) throws BadLocationException {
+ String prefix = identifyPropertyPrefix(doc.get(node.getStartPosition() + 1, offset - (node.getStartPosition() + 1)), offset - (node.getStartPosition() + 1));
+
+ int startOffset = offset - prefix.length();
+ int endOffset = offset;
+
+ String prePrefix = doc.get(node.getStartPosition() + 1, offset - prefix.length() - node.getStartPosition() - 1);
+
+ String preCompletion;
+ if (prePrefix.endsWith("${")) {
+ preCompletion = "";
+ }
+ else if (prePrefix.endsWith("$")) {
+ preCompletion = "{";
+ }
+ else {
+ preCompletion = "${";
+ }
+
+ String fullNodeContent = doc.get(node.getStartPosition(), node.getLength());
+ String postCompletion = isClosingBracketMissing(fullNodeContent + preCompletion) ? "}" : "";
+
+ List> matches = findMatches(prefix);
+
+ for (Match match : matches) {
+
+ DocumentEdits edits = new DocumentEdits(doc);
+ edits.replace(startOffset, endOffset, preCompletion + match.data.getId() + postCompletion);
+
+ ValuePropertyKeyProposal proposal = new ValuePropertyKeyProposal(edits, match.data.getId(), match.data.getName(), null);
+ completions.add(proposal);
+ }
+ }
+
+ private boolean isClosingBracketMissing(String fullNodeContent) {
+ int bracketOpens = 0;
+
+ for (int i = 0; i < fullNodeContent.length(); i++) {
+ if (fullNodeContent.charAt(i) == '{') {
+ bracketOpens++;
+ }
+ else if (fullNodeContent.charAt(i) == '}') {
+ bracketOpens--;
+ }
+ }
+
+ return bracketOpens > 0;
+ }
+
+ public String identifyPropertyPrefix(String nodeContent, int offset) {
+ String result = nodeContent.substring(0, offset);
+
+ int i = offset - 1;
+ while (i >= 0) {
+ char c = nodeContent.charAt(i);
+ if (c == '}' || c == '{' || c == '$' || c == '#') {
+ result = result.substring(i + 1, offset);
+ break;
+ }
+ i--;
+ }
+
+ return result;
+ }
+
+ private List> findMatches(String prefix) {
+ List> matches = index.find(camelCaseToHyphens(prefix));
+ return matches;
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/ValuePropertyKeyProposal.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/ValuePropertyKeyProposal.java
new file mode 100644
index 000000000..3ecf24c09
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/completions/ValuePropertyKeyProposal.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.ide.vscode.boot.java.completions;
+
+import org.eclipse.lsp4j.CompletionItemKind;
+import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
+import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
+import org.springframework.ide.vscode.commons.util.Renderable;
+import org.springframework.ide.vscode.commons.util.text.IDocument;
+
+/**
+ * @author Martin Lippert
+ */
+public class ValuePropertyKeyProposal implements ICompletionProposal {
+
+ private DocumentEdits edits;
+ private String label;
+ private String detail;
+ private Renderable documentation;
+
+ public ValuePropertyKeyProposal(DocumentEdits edits, String label, String detail, Renderable documentation) {
+ this.edits = edits;
+ this.label = label;
+ this.detail = detail;
+ this.documentation = documentation;
+ }
+
+ @Override
+ public ICompletionProposal deemphasize() {
+ return null;
+ }
+
+ @Override
+ public String getLabel() {
+ return this.label;
+ }
+
+ @Override
+ public CompletionItemKind getKind() {
+ return CompletionItemKind.Property;
+ }
+
+ @Override
+ public DocumentEdits getTextEdit() {
+ return this.edits;
+ }
+
+ @Override
+ public String getDetail() {
+ return this.detail;
+ }
+
+ @Override
+ public Renderable getDocumentation() {
+ return this.documentation;
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/hover/BootJavaHoverProvider.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/hover/BootJavaHoverProvider.java
new file mode 100644
index 000000000..f6b7d3379
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/hover/BootJavaHoverProvider.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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.ide.vscode.boot.java.hover;
+
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Stream;
+
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.NodeFinder;
+import org.eclipse.lsp4j.Hover;
+import org.eclipse.lsp4j.TextDocumentPositionParams;
+import org.springframework.ide.vscode.commons.java.IClasspath;
+import org.springframework.ide.vscode.commons.java.IJavaProject;
+import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
+import org.springframework.ide.vscode.commons.languageserver.util.HoverHandler;
+import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
+import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
+import org.springframework.ide.vscode.commons.util.text.IDocument;
+import org.springframework.ide.vscode.commons.util.text.TextDocument;
+
+/**
+ * @author Martin Lippert
+ */
+public class BootJavaHoverProvider implements HoverHandler {
+
+ private static final String SPRING_VALUE = "org.springframework.beans.factory.annotation.Value";
+
+ private JavaProjectFinder projectFinder;
+ private SimpleLanguageServer server;
+
+ public BootJavaHoverProvider(SimpleLanguageServer server, JavaProjectFinder projectFinder) {
+ this.server = server;
+ this.projectFinder = projectFinder;
+ }
+
+ @Override
+ public CompletableFuture handle(TextDocumentPositionParams params) {
+ SimpleTextDocumentService documents = server.getTextDocumentService();
+ TextDocument doc = documents.get(params).copy();
+ if (doc != null) {
+ try {
+ int offset = doc.toOffset(params.getPosition());
+ CompletableFuture hoverResult = provideHover(doc, offset);
+ if (hoverResult != null) {
+ return hoverResult;
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+
+ return SimpleTextDocumentService.NO_HOVER;
+ }
+
+ private CompletableFuture provideHover(TextDocument document, int offset) throws Exception {
+ ASTParser parser = ASTParser.newParser(AST.JLS8);
+ Map options = JavaCore.getOptions();
+ JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
+ parser.setCompilerOptions(options);
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ parser.setStatementsRecovery(true);
+ parser.setBindingsRecovery(true);
+ parser.setResolveBindings(true);
+
+ String[] classpathEntries = getClasspathEntries(document);
+ String[] sourceEntries = new String[] {};
+ parser.setEnvironment(classpathEntries, sourceEntries, null, true);
+
+ String docURI = document.getUri();
+ String unitName = docURI.substring(docURI.lastIndexOf("/"));
+ parser.setUnitName(unitName);
+ parser.setSource(document.get(0, document.getLength()).toCharArray());
+
+ CompilationUnit cu = (CompilationUnit) parser.createAST(null);
+ ASTNode node = NodeFinder.perform(cu, offset, 0);
+
+ if (node != null) {
+ System.out.println("AST node found: " + node.getClass().getName());
+ return provideHoverForAnnotation(node, offset, document);
+ }
+
+ return null;
+ }
+
+ private CompletableFuture provideHoverForAnnotation(ASTNode node, int offset, TextDocument doc) {
+ Annotation annotation = null;
+ ASTNode exactNode = node;
+
+ while (node != null && !(node instanceof Annotation)) {
+ node = node.getParent();
+ }
+
+ if (node != null) {
+ annotation = (Annotation) node;
+ ITypeBinding type = annotation.resolveTypeBinding();
+ if (type != null) {
+ String qualifiedName = type.getQualifiedName();
+ if (qualifiedName != null && qualifiedName.startsWith("org.springframework")) {
+ return provideHoverForSpringAnnotation(exactNode, annotation, type, offset, doc);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private CompletableFuture provideHoverForSpringAnnotation(ASTNode node, Annotation annotation, ITypeBinding type, int offset, TextDocument doc) {
+ if (type.getQualifiedName().equals(SPRING_VALUE)) {
+ return new ValueHoverProvider().provideHoverForValueAnnotation(node, annotation, type, offset, doc);
+ }
+
+ return null;
+ }
+
+ private String[] getClasspathEntries(IDocument doc) throws Exception {
+ IJavaProject project = this.projectFinder.find(doc);
+ IClasspath classpath = project.getClasspath();
+ Stream classpathEntries = classpath.getClasspathEntries();
+ return classpathEntries
+ .filter(path -> path.toFile().exists())
+ .map(path -> path.toAbsolutePath().toString()).toArray(String[]::new);
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/hover/ValueHoverProvider.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/hover/ValueHoverProvider.java
new file mode 100644
index 000000000..08115e1d6
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/java/hover/ValueHoverProvider.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * 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.ide.vscode.boot.java.hover;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+import org.apache.commons.io.IOUtils;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.lsp4j.Hover;
+import org.eclipse.lsp4j.Range;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.springframework.ide.vscode.commons.util.text.TextDocument;
+
+/**
+ * @author Martin Lippert
+ */
+public class ValueHoverProvider {
+
+ public CompletableFuture provideHoverForValueAnnotation(ASTNode node, Annotation annotation,
+ ITypeBinding type, int offset, TextDocument doc) {
+
+ try {
+ // case: @Value("prefix<*>")
+ if (node instanceof StringLiteral && node.getParent() instanceof Annotation) {
+ if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
+ return provideHover(node.toString(), offset - node.getStartPosition(), node.getStartPosition(), doc);
+ }
+ }
+ // case: @Value(value="prefix<*>")
+ else if (node instanceof StringLiteral && node.getParent() instanceof MemberValuePair
+ && "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
+ if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
+ return provideHover(node.toString(), offset - node.getStartPosition(), node.getStartPosition(), doc);
+ }
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ private CompletableFuture provideHover(String value, int offset, int nodeStartOffset, TextDocument doc) {
+
+ try {
+ LocalRange range = getPropertyRange(value, offset);
+ if (range != null) {
+ String propertyKey = value.substring(range.getStart(), range.getEnd());
+
+ JSONObject properties = getPropertiesFromProcess();
+ if (propertyKey != null && properties != null) {
+ Iterator> keys = properties.keys();
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ JSONObject props = properties.getJSONObject(key);
+
+ if (props.has(propertyKey)) {
+ String propertyValue = props.getString(propertyKey);
+
+ Range hoverRange = doc.toRange(nodeStartOffset + range.getStart(), range.getEnd() - range.getStart());
+
+ Hover hover = new Hover();
+ List hoverContent = new ArrayList<>();
+
+ hoverContent.add("property value for " + propertyKey);
+ hoverContent.add(propertyValue);
+ hoverContent.add("coming from:");
+ hoverContent.add(key);
+
+ hover.setContents(hoverContent);
+ hover.setRange(hoverRange);
+
+ return CompletableFuture.completedFuture(hover);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public JSONObject getPropertiesFromProcess() {
+ try {
+ URL url = new URL("http://localhost:8080/env");
+
+ URLConnection con = url.openConnection();
+ InputStream in = con.getInputStream();
+ String encoding = con.getContentEncoding();
+ encoding = encoding == null ? "UTF-8" : encoding;
+ String body = IOUtils.toString(in, encoding);
+
+ JSONTokener tokener = new JSONTokener(body);
+ JSONObject jsonData = new JSONObject(tokener);
+
+ return jsonData;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public String getPropertyKey(String value, int offset) {
+ LocalRange range = getPropertyRange(value, offset);
+ if (range != null) {
+ return value.substring(range.getStart(), range.getEnd());
+ }
+ return null;
+ }
+
+ public LocalRange getPropertyRange(String value, int offset) {
+ int start = -1;
+ int end = -1;
+
+ for (int i = offset - 1; i >= 0; i--) {
+ if (value.charAt(i) == '{') {
+ start = i + 1;
+ break;
+ }
+ else if (value.charAt(i) == '}') {
+ break;
+ }
+ }
+
+ for(int i = offset; i < value.length(); i++) {
+ if (value.charAt(i) == '{' || value.charAt(i) == '$') {
+ break;
+ }
+ else if (value.charAt(i) == '}') {
+ end = i;
+ break;
+ }
+ }
+
+ if (start > 0 && start < value.length() && end > 0 && end <= value.length() && start < end) {
+ return new LocalRange(start, end);
+ }
+
+ return null;
+ }
+
+ public static class LocalRange {
+ private int start;
+ private int end;
+
+ public LocalRange(int start, int end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+ public int getEnd() {
+ return end;
+ }
+
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java
new file mode 100644
index 000000000..2871fb420
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2016, 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.ide.vscode.boot.metadata;
+
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
+import org.springframework.ide.vscode.commons.java.IJavaProject;
+import org.springframework.ide.vscode.commons.languageserver.ProgressService;
+import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.text.IDocument;
+
+public class DefaultSpringPropertyIndexProvider implements SpringPropertyIndexProvider {
+
+ private static final FuzzyMap EMPTY_INDEX = new SpringPropertyIndex(null);
+
+ private JavaProjectFinder javaProjectFinder;
+ private SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager();
+
+ private ProgressService progressService = (id, msg) -> {
+ /* ignore */ };
+
+ public DefaultSpringPropertyIndexProvider(JavaProjectFinder javaProjectFinder) {
+ this.javaProjectFinder = javaProjectFinder;
+ }
+
+ @Override
+ public FuzzyMap getIndex(IDocument doc) {
+ IJavaProject jp = javaProjectFinder.find(doc);
+ if (jp != null) {
+ return indexManager.get(jp, progressService);
+ }
+ return EMPTY_INDEX;
+ }
+
+ public void setProgressService(ProgressService progressService) {
+ this.progressService = progressService;
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/PropertiesLoader.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/PropertiesLoader.java
new file mode 100644
index 000000000..79779f133
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/PropertiesLoader.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2016, 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.ide.vscode.boot.metadata;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.jar.JarFile;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepositoryJsonBuilder;
+import org.springframework.ide.vscode.commons.java.IClasspath;
+
+public class PropertiesLoader {
+
+ private static final String MAIN_SPRING_CONFIGURATION_METADATA_JSON = "META-INF/spring-configuration-metadata.json";
+
+ public static final String ADDITIONAL_SPRING_CONFIGURATION_METADATA_JSON = "META-INF/additional-spring-configuration-metadata.json";
+
+ /**
+ * The default classpath location for config metadata loaded when scanning .jar files on the classpath.
+ */
+ public static final String[] JAR_META_DATA_LOCATIONS = {
+ MAIN_SPRING_CONFIGURATION_METADATA_JSON
+ //Not scanning 'additional' metadata because it integrated already in the main data.
+ };
+
+ /**
+ * The default classpath location for config metadata loaded when scanning project output folders.
+ */
+ public static final String[] PROJECT_META_DATA_LOCATIONS = {
+ MAIN_SPRING_CONFIGURATION_METADATA_JSON,
+ ADDITIONAL_SPRING_CONFIGURATION_METADATA_JSON
+ };
+
+ private static final Logger LOG = Logger.getLogger(PropertiesLoader.class.getName());
+
+ private ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
+
+ public ConfigurationMetadataRepository load(IClasspath classPath) {
+ try {
+ classPath.getClasspathEntries().forEach(entry -> {
+ File fileEntry = entry.toFile();
+ if (fileEntry.exists()) {
+ if (fileEntry.isDirectory()) {
+ loadFromOutputFolder(entry);
+ } else {
+ loadFromJar(entry);
+ }
+ }
+ });
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to retrieve classpath", e);
+ }
+ ConfigurationMetadataRepository repository = builder.build();
+ return repository;
+ }
+
+ private void loadFromOutputFolder(Path outputFolderPath) {
+ if (outputFolderPath != null && Files.exists(outputFolderPath)) {
+ Arrays.stream(PROJECT_META_DATA_LOCATIONS).forEach(mdLoc -> {
+ loadFromJsonFile(outputFolderPath.resolve(mdLoc));
+ });
+ }
+ }
+
+ private void loadFromJsonFile(Path mdf) {
+ if (Files.exists(mdf)) {
+ InputStream is = null;
+ try {
+ is = Files.newInputStream(mdf);
+ loadFromInputStream(is);
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Error loading file '" + mdf + "'", e);
+ } finally {
+ if (is!=null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ //ignore
+ }
+ }
+ }
+ }
+ }
+
+ private void loadFromJar(Path f) {
+ JarFile jarFile = null;
+ try {
+ jarFile = new JarFile(f.toFile());
+ //jarDump(jarFile);
+ for (String loc : JAR_META_DATA_LOCATIONS) {
+ ZipEntry e = jarFile.getEntry(loc);
+ if (e!=null) {
+ loadFrom(jarFile, e);
+ }
+ }
+ } catch (Throwable e) {
+ LOG.log(Level.SEVERE, "Error loading JAR file", e);
+ } finally {
+ if (jarFile!=null) {
+ try {
+ jarFile.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+
+ private void loadFrom(JarFile jarFile, ZipEntry ze) {
+ InputStream is = null;
+ try {
+ is = jarFile.getInputStream(ze);
+ loadFromInputStream(is);
+ } catch (Throwable e) {
+ LOG.log(Level.SEVERE, "Error loading JAR file", e);
+ } finally {
+ if (is!=null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ private void loadFromInputStream(InputStream is) throws IOException {
+ builder.withJsonResource(is);
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java
new file mode 100644
index 000000000..a7d3e6550
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 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.ide.vscode.boot.metadata;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
+import org.springframework.ide.vscode.commons.java.IJavaProject;
+import org.springframework.ide.vscode.commons.languageserver.ProgressService;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+
+/**
+ * Support for Reconciling, Content Assist and Hover Text in spring properties
+ * file all make use of a per-project index of spring properties metadata extracted
+ * from project's classpath. This Index manager is responsible for keeping at most
+ * one index per-project and to keep the index up-to-date.
+ *
+ * @author Kris De Volder
+ */
+public class SpringPropertiesIndexManager {
+
+ private Map indexes = null;
+ private static int progressIdCt = 0;
+
+ public SpringPropertiesIndexManager() {
+ }
+
+ public synchronized FuzzyMap get(IJavaProject project, ProgressService progressService) {
+ if (indexes==null) {
+ indexes = new HashMap<>();
+ }
+
+ SpringPropertyIndex index = indexes.get(project);
+ if (index==null) {
+ String progressId = getProgressId();
+ if (progressService != null) {
+ progressService.progressEvent(progressId, "Indexing Spring Boot Properties...");
+ }
+
+ index = new SpringPropertyIndex(project.getClasspath());
+ indexes.put(project, index);
+
+ if (progressService != null) {
+ progressService.progressEvent(progressId, null);
+ }
+ }
+ return index;
+ }
+
+ private static synchronized String getProgressId() {
+ return DefaultSpringPropertyIndexProvider.class.getName()+ (progressIdCt++);
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java
new file mode 100644
index 000000000..44a244d7e
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2015, 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.ide.vscode.boot.metadata;
+
+import java.util.Collection;
+
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
+import org.springframework.ide.vscode.commons.java.IClasspath;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+
+public class SpringPropertyIndex extends FuzzyMap {
+
+ public SpringPropertyIndex(IClasspath projectPath) {
+ if (projectPath!=null) {
+ PropertiesLoader loader = new PropertiesLoader();
+ ConfigurationMetadataRepository metadata = loader.load(projectPath);
+ Collection allEntries = metadata.getAllProperties().values();
+ for (ConfigurationMetadataProperty item : allEntries) {
+ add(item);
+ }
+ }
+ }
+
+ /**
+ * Dumps out 'test data' based on the current contents of the index. This is not meant to be
+ * used in 'production' code. The idea is to call this method during development to dump a
+ * 'snapshot' of the index onto System.out. The data is printed in a forma so that it can be easily
+ * pasted/used into JUNit testing code.
+ */
+// public void dumpAsTestData() {
+// List> allData = this.find("");
+// for (Match match : allData) {
+// PropertyInfo d = match.data;
+// System.out.println("data("
+// +dumpString(d.getId())+", "
+// +dumpString(d.getType())+", "
+// +dumpString(d.getDefaultValue())+", "
+// +dumpString(d.getDescription()) +");"
+// );
+// for (PropertySource source : d.getSources()) {
+// String st = source.getSourceType();
+// String sm = source.getSourceMethod();
+// if (sm!=null) {
+// System.out.println(d.getId() +" from: "+st+"::"+sm);
+// }
+// }
+// }
+// }
+
+// private String dumpString(Object v) {
+// if (v==null) {
+// return "null";
+// }
+// return dumpString(""+v);
+// }
+
+ private String dumpString(String s) {
+ if (s==null) {
+ return "null";
+ } else {
+ StringBuilder buf = new StringBuilder("\"");
+ for (char c : s.toCharArray()) {
+ switch (c) {
+ case '\r':
+ buf.append("\\r");
+ break;
+ case '\n':
+ buf.append("\\n");
+ break;
+ case '\\':
+ buf.append("\\\\");
+ break;
+ case '\"':
+ buf.append("\\\"");
+ break;
+ default:
+ buf.append(c);
+ break;
+ }
+ }
+ buf.append("\"");
+ return buf.toString();
+ }
+ }
+
+ @Override
+ protected String getKey(ConfigurationMetadataProperty entry) {
+ return entry.getId();
+ }
+
+ /**
+ * Find the longest known property that is a prefix of the given name. Here prefix does not mean
+ * 'string prefix' but a prefix in the sense of treating '.' as a kind of separators. So
+ * 'prefix' is not allowed to end in the middle of a 'segment'.
+ */
+// public static PropertyInfo findLongestValidProperty(FuzzyMap index, String name) {
+// int bracketPos = name.indexOf('[');
+// int endPos = bracketPos>=0?bracketPos:name.length();
+// PropertyInfo prop = null;
+// String prefix = null;
+// while (endPos>0 && prop==null) {
+// prefix = name.substring(0, endPos);
+// String canonicalPrefix = StringUtil.camelCaseToHyphens(prefix);
+// prop = index.get(canonicalPrefix);
+// if (prop==null) {
+// endPos = name.lastIndexOf('.', endPos-1);
+// }
+// }
+// if (prop!=null) {
+// //We should meet caller's expectation that matched properties returned by this method
+// // match the names exactly even if we found them using relaxed name matching.
+// return prop.withId(prefix);
+// }
+// return null;
+// }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java
new file mode 100644
index 000000000..7bd2ee815
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2015, 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.ide.vscode.boot.metadata;
+
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.text.IDocument;
+
+
+@FunctionalInterface
+public interface SpringPropertyIndexProvider {
+ FuzzyMap getIndex(IDocument doc);
+}
diff --git a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ScopeCompletionTest.java b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ScopeCompletionTest.java
index 02f21e878..696ae5547 100644
--- a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ScopeCompletionTest.java
+++ b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ScopeCompletionTest.java
@@ -27,6 +27,7 @@ import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFin
import org.springframework.ide.vscode.languageserver.testharness.Editor;
import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness;
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
+import org.springframework.ide.vscode.project.harness.PropertyIndexHarness;
/**
* @author Martin Lippert
@@ -36,18 +37,21 @@ public class ScopeCompletionTest {
private final JavaProjectFinder javaProjectFinder = (doc) -> getTestProject();
private LanguageServerHarness harness;
+ private PropertyIndexHarness indexHarness;
private IJavaProject testProject;
private Editor editor;
+
@Before
public void setup() throws Exception {
- testProject = ProjectsHarness.INSTANCE.mavenProject("test-scope-annotation");
+ testProject = ProjectsHarness.INSTANCE.mavenProject("test-annotations");
+ indexHarness = new PropertyIndexHarness();
harness = new LanguageServerHarness(new Callable() {
@Override
public BootJavaLanguageServer call() throws Exception {
- BootJavaLanguageServer server = new BootJavaLanguageServer(javaProjectFinder);
+ BootJavaLanguageServer server = new BootJavaLanguageServer(javaProjectFinder, indexHarness.getIndexProvider());
return server;
}
}) {
@@ -155,7 +159,7 @@ public class ScopeCompletionTest {
}
private void prepareCase(String selectedAnnotation, String annotationStatementBeforeTest) throws Exception {
- InputStream resource = this.getClass().getResourceAsStream("/test-projects/test-scope-annotation/src/main/java/org/test/TestScopeCompletion.java");
+ InputStream resource = this.getClass().getResourceAsStream("/test-projects/test-annotations/src/main/java/org/test/TestScopeCompletion.java");
String content = IOUtils.toString(resource);
content = content.replace(selectedAnnotation, annotationStatementBeforeTest);
diff --git a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ValueCompletionTest.java b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ValueCompletionTest.java
new file mode 100644
index 000000000..3a4e25eb2
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/completions/test/ValueCompletionTest.java
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ * 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.ide.vscode.boot.java.completions.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import org.apache.commons.io.IOUtils;
+import org.eclipse.lsp4j.CompletionItem;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.ide.vscode.boot.java.BootJavaLanguageServer;
+import org.springframework.ide.vscode.boot.java.completions.ValueCompletionProcessor;
+import org.springframework.ide.vscode.commons.java.IJavaProject;
+import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
+import org.springframework.ide.vscode.languageserver.testharness.Editor;
+import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness;
+import org.springframework.ide.vscode.project.harness.ProjectsHarness;
+import org.springframework.ide.vscode.project.harness.PropertyIndexHarness;
+
+/**
+ * @author Martin Lippert
+ */
+public class ValueCompletionTest {
+
+ private final JavaProjectFinder javaProjectFinder = (doc) -> getTestProject();
+
+ private LanguageServerHarness harness;
+ private IJavaProject testProject;
+
+ private Editor editor;
+
+ private PropertyIndexHarness indexHarness;
+
+ @Before
+ public void setup() throws Exception {
+ testProject = ProjectsHarness.INSTANCE.mavenProject("test-annotations");
+ indexHarness = new PropertyIndexHarness();
+
+ harness = new LanguageServerHarness(new Callable() {
+ @Override
+ public BootJavaLanguageServer call() throws Exception {
+ BootJavaLanguageServer server = new BootJavaLanguageServer(javaProjectFinder, indexHarness.getIndexProvider());
+ return server;
+ }
+ }) {
+ @Override
+ protected String getFileExtension() {
+ return ".java";
+ }
+ };
+ harness.intialize(null);
+ }
+
+ private IJavaProject getTestProject() {
+ return testProject;
+ }
+
+ @Test
+ public void testPrefixIdentification() {
+ ValueCompletionProcessor processor = new ValueCompletionProcessor(null);
+
+ assertEquals("pre", processor.identifyPropertyPrefix("pre", 3));
+ assertEquals("pre", processor.identifyPropertyPrefix("prefix", 3));
+ assertEquals("", processor.identifyPropertyPrefix("", 0));
+ assertEquals("pre", processor.identifyPropertyPrefix("$pre", 4));
+
+ assertEquals("", processor.identifyPropertyPrefix("${pre", 0));
+ assertEquals("", processor.identifyPropertyPrefix("${pre", 1));
+ assertEquals("", processor.identifyPropertyPrefix("${pre", 2));
+ assertEquals("p", processor.identifyPropertyPrefix("${pre", 3));
+ assertEquals("pr", processor.identifyPropertyPrefix("${pre", 4));
+ }
+
+ @Test
+ public void testEmptyBracketsCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(<*>)");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${data.prop2}\"<*>)",
+ "@Value(\"${else.prop3}\"<*>)",
+ "@Value(\"${spring.prop1}\"<*>)");
+ }
+
+ @Test
+ public void testEmptyBracketsCompletionWithParamName() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(value=<*>)");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(value=\"${data.prop2}\"<*>)",
+ "@Value(value=\"${else.prop3}\"<*>)",
+ "@Value(value=\"${spring.prop1}\"<*>)");
+ }
+
+ @Test
+ public void testEmptyBracketsCompletionWithWrongParamName() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(another=<*>)");
+ prepareDefaultIndexData();
+ assertAnnotationCompletions();
+ }
+
+ @Test
+ public void testOnlyDollarNoQoutesCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value($<*>)");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${data.prop2}\"<*>)",
+ "@Value(\"${else.prop3}\"<*>)",
+ "@Value(\"${spring.prop1}\"<*>)");
+ }
+
+ @Test
+ public void testOnlyDollarNoQoutesWithParamCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(value=$<*>)");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(value=\"${data.prop2}\"<*>)",
+ "@Value(value=\"${else.prop3}\"<*>)",
+ "@Value(value=\"${spring.prop1}\"<*>)");
+ }
+
+ @Test
+ public void testOnlyDollarCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"$<*>\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${data.prop2}<*>\")",
+ "@Value(\"${else.prop3}<*>\")",
+ "@Value(\"${spring.prop1}<*>\")");
+ }
+
+ @Test
+ public void testOnlyDollarWithParamCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(value=\"$<*>\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(value=\"${data.prop2}<*>\")",
+ "@Value(value=\"${else.prop3}<*>\")",
+ "@Value(value=\"${spring.prop1}<*>\")");
+ }
+
+ @Test
+ public void testDollarWithBracketsCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"${<*>}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${data.prop2<*>}\")",
+ "@Value(\"${else.prop3<*>}\")",
+ "@Value(\"${spring.prop1<*>}\")");
+ }
+
+ @Test
+ public void testDollarWithBracketsWithParamCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(value=\"${<*>}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(value=\"${data.prop2<*>}\")",
+ "@Value(value=\"${else.prop3<*>}\")",
+ "@Value(value=\"${spring.prop1<*>}\")");
+ }
+
+ @Test
+ public void testEmptyStringLiteralCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"<*>\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${data.prop2}<*>\")",
+ "@Value(\"${else.prop3}<*>\")",
+ "@Value(\"${spring.prop1}<*>\")");
+ }
+
+ @Test
+ public void testPlainPrefixCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(spri<*>)");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${spring.prop1}\"<*>)");
+ }
+
+ @Test
+ public void testQoutedPrefixCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"spri<*>\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"${spring.prop1}<*>\")");
+ }
+
+ @Test
+ public void testRandomSpelExpressionNoCompletion() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"#{<*>}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"#{${data.prop2}<*>}\")",
+ "@Value(\"#{${else.prop3}<*>}\")",
+ "@Value(\"#{${spring.prop1}<*>}\")");
+ }
+
+ @Test
+ public void testRandomSpelExpressionWithPropertyDollar() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"#{345$<*>}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"#{345${data.prop2}<*>}\")",
+ "@Value(\"#{345${else.prop3}<*>}\")",
+ "@Value(\"#{345${spring.prop1}<*>}\")");
+ }
+
+ @Test
+ public void testRandomSpelExpressionWithPropertyDollerWithoutClosindBracket() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"#{345${<*>}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"#{345${data.prop2}<*>}\")",
+ "@Value(\"#{345${else.prop3}<*>}\")",
+ "@Value(\"#{345${spring.prop1}<*>}\")");
+ }
+
+ @Test
+ public void testRandomSpelExpressionWithPropertyDollerWithClosingBracket() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"#{345${<*>}}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"#{345${data.prop2<*>}}\")",
+ "@Value(\"#{345${else.prop3<*>}}\")",
+ "@Value(\"#{345${spring.prop1<*>}}\")");
+ }
+
+ @Test
+ public void testRandomSpelExpressionWithPropertyPrefixWithoutClosingBracket() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"#{345${spri<*>}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"#{345${spring.prop1}<*>}\")");
+ }
+
+ @Test
+ public void testRandomSpelExpressionWithPropertyPrefixWithClosingBracket() throws Exception {
+ prepareCase("@Value(\"onField\")", "@Value(\"#{345${spri<*>}}\")");
+ prepareDefaultIndexData();
+
+ assertAnnotationCompletions(
+ "@Value(\"#{345${spring.prop1<*>}}\")");
+ }
+
+ private void prepareDefaultIndexData() {
+ indexHarness.data("spring.prop1", "java.lang.String", null, null);
+ indexHarness.data("data.prop2", "java.lang.String", null, null);
+ indexHarness.data("else.prop3", "java.lang.String", null, null);
+ }
+
+ private void prepareCase(String selectedAnnotation, String annotationStatementBeforeTest) throws Exception {
+ InputStream resource = this.getClass().getResourceAsStream("/test-projects/test-annotations/src/main/java/org/test/TestValueCompletion.java");
+ String content = IOUtils.toString(resource);
+
+ content = content.replace(selectedAnnotation, annotationStatementBeforeTest);
+ editor = new Editor(harness, content, "java");
+ }
+
+ private void assertAnnotationCompletions(String... completedAnnotations) throws Exception {
+ List completions = editor.getCompletions();
+ int i = 0;
+ for (String expectedCompleted : completedAnnotations) {
+ Editor clonedEditor = editor.clone();
+ clonedEditor.apply(completions.get(i++));
+ assertTrue(clonedEditor.getText().contains(expectedCompleted));
+ }
+
+ assertEquals(i, completions.size());
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/hover/test/ValueHoverTest.java b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/hover/test/ValueHoverTest.java
new file mode 100644
index 000000000..63a3401a9
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/boot/java/hover/test/ValueHoverTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.ide.vscode.boot.java.hover.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+import org.springframework.ide.vscode.boot.java.hover.ValueHoverProvider;
+
+/**
+ * @author Martin Lippert
+ */
+public class ValueHoverTest {
+
+ @Test
+ public void testGetPropertyFromValue() {
+ ValueHoverProvider provider = new ValueHoverProvider();
+
+ assertNull(provider.getPropertyKey("${spring}", 0));
+ assertNull(provider.getPropertyKey("${spring}", 1));
+ assertEquals("spring", provider.getPropertyKey("${spring}", 2));
+ assertEquals("spring", provider.getPropertyKey("${spring}", 3));
+ assertEquals("spring", provider.getPropertyKey("${spring}", 8));
+ assertNull(provider.getPropertyKey("${spring}", 9));
+
+ assertNull(provider.getPropertyKey("abc ${spring} and other stuff", 0));
+ assertNull(provider.getPropertyKey("abc ${spring} and other stuff", 5));
+ assertEquals("spring", provider.getPropertyKey("abc ${spring} and other stuff", 6));
+ assertEquals("spring", provider.getPropertyKey("abc ${spring} and other stuff", 12));
+ assertNull(provider.getPropertyKey("abc ${spring} and other stuff", 13));
+
+ assertNull(provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 5));
+ assertEquals("spring", provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 6));
+ assertEquals("spring", provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 12));
+ assertNull(provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 13));
+
+ assertNull(provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 19));
+ assertEquals("boot", provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 20));
+ assertEquals("boot", provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 24));
+ assertNull(provider.getPropertyKey("abc ${spring} and ${boot} other stuff", 25));
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java
index 7f56c7744..516a0c3d4 100644
--- a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java
+++ b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Pivotal, Inc.
+ * Copyright (c) 2016, 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
@@ -29,7 +29,6 @@ import com.google.common.cache.CacheBuilder;
* Test projects harness
*
* @author Alex Boyko
- *
*/
public class ProjectsHarness {
@@ -51,7 +50,7 @@ public class ProjectsHarness {
switch (type) {
case MAVEN:
MavenBuilder.newBuilder(testProjectPath).clean().pack().javadoc().skipTests().execute();
- return new MavenJavaProject(testProjectPath.resolve(MavenCore.POM_XML).toFile());
+ return new MavenJavaProject(MavenCore.getDefault(), testProjectPath.resolve(MavenCore.POM_XML).toFile());
case CLASSPATH_TXT:
MavenBuilder.newBuilder(testProjectPath).clean().pack().skipTests().execute();
return new JavaProjectWithClasspathFile(testProjectPath.resolve(MavenCore.CLASSPATH_TXT).toFile());
@@ -62,94 +61,13 @@ public class ProjectsHarness {
}
protected Path getProjectPath(String name) throws URISyntaxException, IOException {
-// URI sourceLocation = ProjectsHarness.class.getProtectionDomain().getCodeSource().getLocation().toURI();
-// // file:/Users/aboyko/git/sts4/vscode-extensions/commons/project-test-harness/target/project-test-harness-0.0.1-SNAPSHOT.jar
-// Path testProjectsPath = Paths.get(sourceLocation).getParent().getParent().resolve("test-projects").resolve(name);
-// if (Files.exists(testProjectsPath)) {
-// return testProjectsPath;
-// } else {
-// /*
-// * If "test-projects" folder is not found then extract test project
-// * from the jar's "test-projects" folder and copy it in the temp
-// * folder
-// */
- return getProjectPathFromClasspath(name);
-// }
+ return getProjectPathFromClasspath(name);
}
private Path getProjectPathFromClasspath(String name) throws URISyntaxException, IOException {
URI resource = ProjectsHarness.class.getResource("/test-projects/" + name).toURI();
-// if (resource.getScheme().equalsIgnoreCase("jar")) {
-// return getProjectPathFromJar(resource);
-// } else {
- return Paths.get(resource);
-// }
- }
-
-// private Path getProjectPathFromJar(URI jar) throws IOException {
-// final String[] array = jar.toString().split("!");
-// URI firstHalf = URI.create(array[0]);
-// Path tempFolderPath = Paths.get(new File(System.getProperty(MavenCore.JAVA_IO_TMPDIR)).toURI());
-// FileSystem fs = FileSystems.newFileSystem(firstHalf, Collections.emptyMap());
-// try {
-// Path path = fs.getPath(array[1]);
-// Path projectCopyPath = tempFolderPath.resolve(path.getFileName().toString());
-// if (Files.exists(projectCopyPath)) {
-// recursiveDelete(projectCopyPath);
-// }
-// recursiveCopy(path, tempFolderPath, StandardCopyOption.REPLACE_EXISTING);
-// System.out.println("Copied test project to: " + projectCopyPath);
-// return projectCopyPath;
-// } finally {
-// fs.close();
-// }
-// }
-//
-// private static void recursiveCopy(Path source, Path target, CopyOption... options) throws IOException {
-// Files.walkFileTree(source, new SimpleFileVisitor() {
-//
-// Path destination = target;
-//
-// @Override
-// public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
-// destination = destination.resolve(dir.getFileName().toString());
-// Files.copy(dir, destination, options);
-// return super.preVisitDirectory(dir, attrs);
-// }
-//
-// @Override
-// public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-// Path newFile = destination.resolve(file.getFileName().toString());
-// Files.copy(file, newFile, options);
-// return super.visitFile(file, attrs);
-// }
-//
-// @Override
-// public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
-// destination = destination.getParent();
-// return super.postVisitDirectory(dir, exc);
-// }
-//
-// });
-// }
-//
-// private static void recursiveDelete(Path path) throws IOException {
-// Files.walkFileTree(path, new SimpleFileVisitor() {
-//
-// @Override
-// public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-// Files.delete(file);
-// return super.visitFile(file, attrs);
-// }
-//
-// @Override
-// public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
-// Files.delete(dir);
-// return super.postVisitDirectory(dir, exc);
-// }
-//
-// });
-// }
+ return Paths.get(resource);
+ }
public MavenJavaProject mavenProject(String name) throws Exception {
return (MavenJavaProject) project(ProjectType.MAVEN, name);
diff --git a/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/PropertyIndexHarness.java b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/PropertyIndexHarness.java
new file mode 100644
index 000000000..0295f438c
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/test/java/org/springframework/ide/vscode/project/harness/PropertyIndexHarness.java
@@ -0,0 +1,562 @@
+/*******************************************************************************
+ * 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.ide.vscode.project.harness;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
+import org.springframework.boot.configurationmetadata.Deprecation;
+import org.springframework.boot.configurationmetadata.ValueHint;
+import org.springframework.boot.configurationmetadata.ValueProvider;
+import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndex;
+import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
+import org.springframework.ide.vscode.commons.java.IClasspath;
+import org.springframework.ide.vscode.commons.java.IJavaProject;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.text.IDocument;
+
+/**
+ * Provides some convenience apis for test code to create / use test data for a SpringPropertyIndex.
+ */
+public class PropertyIndexHarness {
+
+ private Map datas = new LinkedHashMap<>();
+ private SpringPropertyIndex index = null;
+ private IJavaProject testProject = null;
+
+ protected final SpringPropertyIndexProvider indexProvider = new SpringPropertyIndexProvider() {
+ @Override
+ public FuzzyMap getIndex(IDocument doc) {
+ synchronized (PropertyIndexHarness.this) {
+ if (index==null) {
+ IClasspath classpath = testProject == null ? null : testProject.getClasspath();
+ index = new SpringPropertyIndex(classpath);
+ for (ConfigurationMetadataProperty propertyInfo : datas.values()) {
+ index.add(propertyInfo);
+ }
+ }
+ return index;
+ }
+ }
+ };
+
+ public synchronized void useProject(IJavaProject p) throws Exception {
+ index = null;
+ this.testProject = p;
+ }
+
+ public class ItemConfigurer {
+
+ private ConfigurationMetadataProperty item;
+
+ public ItemConfigurer(ConfigurationMetadataProperty item) {
+ this.item = item;
+ }
+
+ /**
+ * Add a provider with a single parameter.
+ * @return
+ */
+ public ItemConfigurer provider(String name, String paramName, Object paramValue) {
+ ValueProvider provider = new ValueProvider();
+ provider.setName(name);
+ provider.getParameters().put(paramName, paramValue);
+ item.getHints().getValueProviders().add(provider);
+ return this;
+ }
+
+ /**
+ * Add a value hint. If description contains a '.' the dot is used
+ * to break description into a short and long description.
+ * @return
+ */
+ public ItemConfigurer valueHint(Object value, String description) {
+ ValueHint hint = new ValueHint();
+ hint.setValue(value);
+ if (description!=null) {
+ int dotPos = description.indexOf('.');
+ if (dotPos>=0) {
+ hint.setShortDescription( description.substring(0, dotPos));
+ }
+ hint.setDescription(description);
+ }
+ item.getHints().getValueHints().add(hint);
+ return this;
+ }
+ }
+
+
+ public synchronized ItemConfigurer data(String id, String type, Object deflt, String description,
+ String... source
+ ) {
+ ConfigurationMetadataProperty item = new ConfigurationMetadataProperty();
+ item.setId(id);
+ item.setDescription(description);
+ item.setType(type);
+ item.setDefaultValue(deflt);
+ index = null;
+ datas.put(item.getId(), item);
+ return new ItemConfigurer(item);
+ }
+
+ public synchronized void keyHints(String id, String... hintValues) {
+ index = null;
+ List hints = datas.get(id).getHints().getKeyHints();
+ for (String value : hintValues) {
+ ValueHint hint = new ValueHint();
+ hint.setValue(value);
+ hints.add(hint);
+ }
+ }
+
+ public synchronized void valueHints(String id, String... hintValues) {
+ index = null;
+ List hints = datas.get(id).getHints().getValueHints();
+ for (String value : hintValues) {
+ ValueHint hint = new ValueHint();
+ hint.setValue(value);
+ hints.add(hint);
+ }
+ }
+
+ public synchronized void deprecate(String key, String replacedBy, String reason) {
+ index = null;
+ ConfigurationMetadataProperty info = datas.get(key);
+ Deprecation d = new Deprecation();
+ d.setReplacement(replacedBy);
+ d.setReason(reason);
+ info.setDeprecation(d);
+ }
+
+ /**
+ * Call this method to add some default test data to the Completion engine's index.
+ * Note that this data is not added automatically, some test may want to use smaller
+ * test data sets.
+ */
+ public void defaultTestData() {
+ data("banner.charset", "java.nio.charset.Charset", "UTF-8", "Banner file encoding.");
+ data("banner.location", "java.lang.String", "classpath:banner.txt", "Banner file location.");
+ data("debug", "java.lang.Boolean", "false", "Enable debug logs.");
+ data("flyway.check-location", "java.lang.Boolean", "false", "Check that migration scripts location exists.");
+ data("flyway.clean-on-validation-error", "java.lang.Boolean", null, null);
+ data("flyway.enabled", "java.lang.Boolean", "true", "Enable flyway.");
+ data("flyway.encoding", "java.lang.String", null, null);
+ data("flyway.ignore-failed-future-migration", "java.lang.Boolean", null, null);
+ data("flyway.init-description", "java.lang.String", null, null);
+ data("flyway.init-on-migrate", "java.lang.Boolean", null, null);
+ data("flyway.init-sqls", "java.util.List", null, "SQL statements to execute to initialize a connection immediately after obtaining\n it.");
+ data("flyway.init-version", "org.flywaydb.core.api.MigrationVersion", null, null);
+ data("flyway.locations", "java.util.List", null, "Locations of migrations scripts.");
+ data("flyway.out-of-order", "java.lang.Boolean", null, null);
+ data("flyway.password", "java.lang.String", null, "Login password of the database to migrate.");
+ data("flyway.placeholder-prefix", "java.lang.String", null, null);
+ data("flyway.placeholders", "java.util.Map", null, null);
+ data("flyway.placeholder-suffix", "java.lang.String", null, null);
+ data("flyway.schemas", "java.lang.String[]", null, null);
+ data("flyway.sql-migration-prefix", "java.lang.String", null, null);
+ data("flyway.sql-migration-separator", "java.lang.String", null, null);
+ data("flyway.sql-migration-suffix", "java.lang.String", null, null);
+ data("flyway.table", "java.lang.String", null, null);
+ data("flyway.target", "org.flywaydb.core.api.MigrationVersion", null, null);
+ data("flyway.url", "java.lang.String", null, "JDBC url of the database to migrate. If not set, the primary configured data source\n is used.");
+ data("flyway.user", "java.lang.String", null, "Login user of the database to migrate.");
+ data("flyway.validate-on-migrate", "java.lang.Boolean", null, null);
+ data("http.mappers.json-pretty-print", "java.lang.Boolean", null, "Enable json pretty print.");
+ data("http.mappers.json-sort-keys", "java.lang.Boolean", null, "Enable key sorting.");
+ data("liquibase.change-log", "java.lang.String", "classpath:/db/changelog/db.changelog-master.yaml", "Change log configuration path.");
+ data("liquibase.check-change-log-location", "java.lang.Boolean", "true", "Check the change log location exists.");
+ data("liquibase.contexts", "java.lang.String", null, "Comma-separated list of runtime contexts to use.");
+ data("liquibase.default-schema", "java.lang.String", null, "Default database schema.");
+ data("liquibase.drop-first", "java.lang.Boolean", "false", "Drop the database schema first.");
+ data("liquibase.enabled", "java.lang.Boolean", "true", "Enable liquibase support.");
+ data("liquibase.password", "java.lang.String", null, "Login password of the database to migrate.");
+ data("liquibase.url", "java.lang.String", null, "JDBC url of the database to migrate. If not set, the primary configured data source\n is used.");
+ data("liquibase.user", "java.lang.String", null, "Login user of the database to migrate.");
+ data("logging.config", "java.lang.String", null, "Location of the logging configuration file.");
+ data("logging.file", "java.lang.String", null, "Log file name.");
+ data("logging.level", "java.util.Map", null, "Log levels severity mapping. Use 'root' for the root logger.");
+ data("logging.path", "java.lang.String", null, "Location of the log file.");
+ data("multipart.file-size-threshold", "java.lang.String", "0", "Threshold after which files will be written to disk. Values can use the suffixed\n \"MB\" or \"KB\" to indicate a Megabyte or Kilobyte size.");
+ data("multipart.location", "java.lang.String", null, "Intermediate location of uploaded files.");
+ data("multipart.max-file-size", "java.lang.String", "1Mb", "Max file size. Values can use the suffixed \"MB\" or \"KB\" to indicate a Megabyte or\n Kilobyte size.");
+ data("multipart.max-request-size", "java.lang.String", "10Mb", "Max request size. Values can use the suffixed \"MB\" or \"KB\" to indicate a Megabyte\n or Kilobyte size.");
+ data("security.basic.enabled", "java.lang.Boolean", "true", "Enable basic authentication.");
+ data("security.basic.path", "java.lang.String[]", "[Ljava.lang.Object;@7abd0056", "Comma-separated list of paths to secure.");
+ data("security.basic.realm", "java.lang.String", "Spring", "HTTP basic realm name.");
+ data("security.enable-csrf", "java.lang.Boolean", "false", "Enable Cross Site Request Forgery support.");
+ data("security.filter-order", "java.lang.Integer", "0", "Security filter chain order.");
+ data("security.headers.cache", "java.lang.Boolean", "false", "Enable cache control HTTP headers.");
+ data("security.headers.content-type", "java.lang.Boolean", "false", "Enable \"X-Content-Type-Options\" header.");
+ data("security.headers.frame", "java.lang.Boolean", "false", "Enable \"X-Frame-Options\" header.");
+ data("security.headers.hsts", "org.springframework.boot.autoconfigure.security.SecurityProperties$Headers$HSTS", null, "HTTP Strict Transport Security (HSTS) mode (none, domain, all).");
+ data("security.headers.xss", "java.lang.Boolean", "false", "Enable cross site scripting (XSS) protection.");
+ data("security.ignored", "java.util.List", null, "Comma-separated list of paths to exclude from the default secured paths.");
+ data("security.require-ssl", "java.lang.Boolean", "false", "Enable secure channel for all requests.");
+ data("security.sessions", "org.springframework.security.config.http.SessionCreationPolicy", null, "Session creation policy (always, never, if_required, stateless).");
+ data("security.user.name", "java.lang.String", "user", "Default user name.");
+ data("security.user.password", "java.lang.String", null, "Password for the default user name.");
+ data("security.user.role", "java.util.List", null, "Granted roles for the default user name.");
+ data("server.address", "java.net.InetAddress", null, "Network address to which the server should bind to.");
+ data("server.context-parameters", "java.util.Map", null, "ServletContext parameters.");
+ data("server.context-path", "java.lang.String", null, "Context path of the application.");
+ data("server.port", "java.lang.Integer", null, "Server HTTP port.");
+ data("server.servlet-path", "java.lang.String", "/", "Path of the main dispatcher servlet.");
+ data("server.session-timeout", "java.lang.Integer", null, "Session timeout in seconds.");
+ data("server.ssl.ciphers", "java.lang.String[]", null, null);
+ data("server.ssl.client-auth", "org.springframework.boot.context.embedded.Ssl$ClientAuth", null, null);
+ data("server.ssl.key-alias", "java.lang.String", null, null);
+ data("server.ssl.key-password", "java.lang.String", null, null);
+ data("server.ssl.key-store", "java.lang.String", null, null);
+ data("server.ssl.key-store-password", "java.lang.String", null, null);
+ data("server.ssl.key-store-provider", "java.lang.String", null, null);
+ data("server.ssl.key-store-type", "java.lang.String", null, null);
+ data("server.ssl.protocol", "java.lang.String", null, null);
+ data("server.ssl.trust-store", "java.lang.String", null, null);
+ data("server.ssl.trust-store-password", "java.lang.String", null, null);
+ data("server.ssl.trust-store-provider", "java.lang.String", null, null);
+ data("server.ssl.trust-store-type", "java.lang.String", null, null);
+ data("server.tomcat.access-log-enabled", "java.lang.Boolean", "false", "Enable access log.");
+ data("server.tomcat.access-log-pattern", "java.lang.String", null, "Format pattern for access logs.");
+ data("server.tomcat.background-processor-delay", "java.lang.Integer", "30", "Delay in seconds between the invocation of backgroundProcess methods.");
+ data("server.tomcat.basedir", "java.io.File", null, "Tomcat base directory. If not specified a temporary directory will be used.");
+ data("server.tomcat.internal-proxies", "java.lang.String", "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|192\\.168\\.\\d{1,3}\\.\\d{1,3}|169\\.254\\.\\d{1,3}\\.\\d{1,3}|127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}", "Regular expression that matches proxies that are to be trusted.");
+ data("server.tomcat.max-http-header-size", "java.lang.Integer", "0", "Maximum size in bytes of the HTTP message header.");
+ data("server.tomcat.max-threads", "java.lang.Integer", "0", "Maximum amount of worker threads.");
+ data("server.tomcat.port-header", "java.lang.String", null, "Name of the HTTP header used to override the original port value.");
+ data("server.tomcat.protocol-header", "java.lang.String", null, "Header that holds the incoming protocol, usually named \"X-Forwarded-Proto\".\n Configured as a RemoteIpValve only if remoteIpHeader is also set.");
+ data("server.tomcat.remote-ip-header", "java.lang.String", null, "Name of the http header from which the remote ip is extracted. Configured as a\n RemoteIpValve only if remoteIpHeader is also set.");
+ data("server.tomcat.uri-encoding", "java.lang.String", null, "Character encoding to use to decode the URI.");
+ data("server.undertow.buffer-size", "java.lang.Integer", null, "Size of each buffer in bytes.");
+ data("server.undertow.buffers-per-region", "java.lang.Integer", null, "Number of buffer per region.");
+ data("server.undertow.direct-buffers", "java.lang.Boolean", null, null);
+ data("server.undertow.io-threads", "java.lang.Integer", null, "Number of I/O threads to create for the worker.");
+ data("server.undertow.worker-threads", "java.lang.Integer", null, "Number of worker threads.");
+ data("spring.activemq.broker-url", "java.lang.String", null, "URL of the ActiveMQ broker. Auto-generated by default.");
+ data("spring.activemq.in-memory", "java.lang.Boolean", "true", "Specify if the default broker URL should be in memory. Ignored if an explicit\n broker has been specified.");
+ data("spring.activemq.password", "java.lang.String", null, "Login password of the broker.");
+ data("spring.activemq.pooled", "java.lang.Boolean", "false", "Specify if a PooledConnectionFactory should be created instead of a regular\n ConnectionFactory.");
+ data("spring.activemq.user", "java.lang.String", null, "Login user of the broker.");
+ data("spring.aop.auto", "java.lang.Boolean", "true", "Add @EnableAspectJAutoProxy.");
+ data("spring.aop.proxy-target-class", "java.lang.Boolean", "false", "Whether subclass-based (CGLIB) proxies are to be created (true) as opposed to standard Java interface-based proxies (false).");
+ data("spring.application.index", "java.lang.Integer", null, "Application index.");
+ data("spring.application.name", "java.lang.String", null, "Application name.");
+ data("spring.batch.initializer.enabled", "java.lang.Boolean", "true", "Create the required batch tables on startup if necessary.");
+ data("spring.batch.job.enabled", "java.lang.Boolean", "true", "Execute all Spring Batch jobs in the context on startup.");
+ data("spring.batch.job.names", "java.lang.String", "", "Comma-separated list of job names to execute on startup. By default, all Jobs\n found in the context are executed.");
+ data("spring.batch.schema", "java.lang.String", "classpath:org/springframework/batch/core/schema-@@platform@@.sql", "Path to the SQL file to use to initialize the database schema.");
+ data("spring.config.location", "java.lang.String", null, "Config file locations.");
+ data("spring.config.name", "java.lang.String", "application", "Config file name.");
+ data("spring.dao.exceptiontranslation.enabled", "java.lang.Boolean", "true", "Enable the PersistenceExceptionTranslationPostProcessor.");
+ data("spring.data.elasticsearch.cluster-name", "java.lang.String", "elasticsearch", "Elasticsearch cluster name.");
+ data("spring.data.elasticsearch.cluster-nodes", "java.lang.String", null, "Comma-separated list of cluster node addresses. If not specified, starts a client\n node.");
+ data("spring.data.elasticsearch.repositories.enabled", "java.lang.Boolean", "true", "Enable Elasticsearch repositories.");
+ data("spring.data.jpa.repositories.enabled", "java.lang.Boolean", "true", "Enable JPA repositories.");
+ data("spring.data.mongodb.authentication-database", "java.lang.String", null, "Authentication database name.");
+ data("spring.data.mongodb.database", "java.lang.String", null, "Database name.");
+ data("spring.data.mongodb.grid-fs-database", "java.lang.String", null, "GridFS database name.");
+ data("spring.data.mongodb.host", "java.lang.String", null, "Mongo server host.");
+ data("spring.data.mongodb.password", "char[]", null, "Login password of the mongo server.");
+ data("spring.data.mongodb.port", "java.lang.Integer", null, "Mongo server port.");
+ data("spring.data.mongodb.repositories.enabled", "java.lang.Boolean", "true", "Enable Mongo repositories.");
+ data("spring.data.mongodb.uri", "java.lang.String", "mongodb://localhost/test", "Mmongo database URI. When set, host and port are ignored.");
+ data("spring.data.mongodb.username", "java.lang.String", null, "Login user of the mongo server.");
+ data("spring.data.rest.base-uri", "java.net.URI", null, null);
+ data("spring.data.rest.default-page-size", "java.lang.Integer", null, null);
+ data("spring.data.rest.limit-param-name", "java.lang.String", null, null);
+ data("spring.data.rest.max-page-size", "java.lang.Integer", null, null);
+ data("spring.data.rest.page-param-name", "java.lang.String", null, null);
+ data("spring.data.rest.return-body-on-create", "java.lang.Boolean", null, null);
+ data("spring.data.rest.return-body-on-update", "java.lang.Boolean", null, null);
+ data("spring.data.rest.sort-param-name", "java.lang.String", null, null);
+ data("spring.data.solr.host", "java.lang.String", "http://127.0.0.1:8983/solr", "Solr host. Ignored if \"zk-host\" is set.");
+ data("spring.data.solr.repositories.enabled", "java.lang.Boolean", "true", "Enable Solr repositories.");
+ data("spring.data.solr.zk-host", "java.lang.String", null, "ZooKeeper host address in the form HOST:PORT.");
+ data("spring.datasource.abandon-when-percentage-full", "java.lang.Integer", null, null);
+ data("spring.datasource.access-to-underlying-connection-allowed", "java.lang.Boolean", null, null);
+ data("spring.datasource.alternate-username-allowed", "java.lang.Boolean", null, null);
+ data("spring.datasource.auto-commit", "java.lang.Boolean", null, null);
+ data("spring.datasource.catalog", "java.lang.String", null, null);
+ data("spring.datasource.commit-on-return", "java.lang.Boolean", null, null);
+ data("spring.datasource.connection-customizer-class-name", "java.lang.String", null, null);
+ data("spring.datasource.connection-init-sql", "java.lang.String", null, null);
+ data("spring.datasource.connection-init-sqls", "java.util.Collection", null, null);
+ data("spring.datasource.connection-properties", "java.lang.String", null, null);
+ data("spring.datasource.connection-test-query", "java.lang.String", null, null);
+ data("spring.datasource.connection-timeout", "java.lang.Long", null, null);
+ data("spring.datasource.continue-on-error", "java.lang.Boolean", "false", "Do not stop if an error occurs while initializing the database.");
+ data("spring.datasource.data", "java.lang.String", null, "Data (DML) script resource reference.");
+ data("spring.datasource.data-source-class-name", "java.lang.String", null, null);
+ data("spring.datasource.data-source", "java.lang.Object", null, null);
+ data("spring.datasource.data-source-j-n-d-i", "java.lang.String", null, null);
+ data("spring.datasource.data-source-properties", "java.util.Properties", null, null);
+ data("spring.datasource.db-properties", "java.util.Properties", null, null);
+ data("spring.datasource.default-auto-commit", "java.lang.Boolean", null, null);
+ data("spring.datasource.default-catalog", "java.lang.String", null, null);
+ data("spring.datasource.default-read-only", "java.lang.Boolean", null, null);
+ data("spring.datasource.default-transaction-isolation", "java.lang.Integer", null, null);
+ data("spring.datasource.driver-class-name", "java.lang.String", null, "Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.");
+ data("spring.datasource.fair-queue", "java.lang.Boolean", null, null);
+ data("spring.datasource.idle-timeout", "java.lang.Long", null, null);
+ data("spring.datasource.ignore-exception-on-pre-load", "java.lang.Boolean", null, null);
+ data("spring.datasource.initialization-fail-fast", "java.lang.Boolean", null, null);
+ data("spring.datasource.initialize", "java.lang.Boolean", "true", "Populate the database using 'data.sql'.");
+ data("spring.datasource.initial-size", "java.lang.Integer", null, null);
+ data("spring.datasource.init-s-q-l", "java.lang.String", null, null);
+ data("spring.datasource.isolate-internal-queries", "java.lang.Boolean", null, null);
+ data("spring.datasource.jdbc4-connection-test", "java.lang.Boolean", null, null);
+ data("spring.datasource.jdbc-interceptors", "java.lang.String", null, null);
+ data("spring.datasource.jdbc-url", "java.lang.String", null, null);
+ data("spring.datasource.jmx-enabled", "java.lang.Boolean", "false", "Enable JMX support (if provided by the underlying pool).");
+ data("spring.datasource.jndi-name", "java.lang.String", null, "JNDI location of the datasource. Class, url, username & password are ignored when\n set.");
+ data("spring.datasource.leak-detection-threshold", "java.lang.Long", null, null);
+ data("spring.datasource.log-abandoned", "java.lang.Boolean", null, null);
+ data("spring.datasource.login-timeout", "java.lang.Integer", null, null);
+ data("spring.datasource.log-validation-errors", "java.lang.Boolean", null, null);
+ data("spring.datasource.max-active", "java.lang.Integer", null, null);
+ data("spring.datasource.max-age", "java.lang.Long", null, null);
+ data("spring.datasource.max-idle", "java.lang.Integer", null, null);
+ data("spring.datasource.maximum-pool-size", "java.lang.Integer", null, null);
+ data("spring.datasource.max-lifetime", "java.lang.Long", null, null);
+ data("spring.datasource.max-open-prepared-statements", "java.lang.Integer", null, null);
+ data("spring.datasource.max-wait", "java.lang.Integer", null, null);
+ data("spring.datasource.metric-registry", "java.lang.Object", null, null);
+ data("spring.datasource.min-evictable-idle-time-millis", "java.lang.Integer", null, null);
+ data("spring.datasource.min-idle", "java.lang.Integer", null, null);
+ data("spring.datasource.minimum-idle", "java.lang.Integer", null, null);
+ data("spring.datasource.name", "java.lang.String", null, null);
+ data("spring.datasource.num-tests-per-eviction-run", "java.lang.Integer", null, null);
+ data("spring.datasource.password", "java.lang.String", null, "Login password of the database.");
+ data("spring.datasource.platform", "java.lang.String", "all", "Platform to use in the schema resource (schema-${platform}.sql).");
+ data("spring.datasource.pool-name", "java.lang.String", null, null);
+ data("spring.datasource.pool-prepared-statements", "java.lang.Boolean", null, null);
+ data("spring.datasource.propagate-interrupt-state", "java.lang.Boolean", null, null);
+ data("spring.datasource.read-only", "java.lang.Boolean", null, null);
+ data("spring.datasource.register-mbeans", "java.lang.Boolean", null, null);
+ data("spring.datasource.remove-abandoned", "java.lang.Boolean", null, null);
+ data("spring.datasource.remove-abandoned-timeout", "java.lang.Integer", null, null);
+ data("spring.datasource.rollback-on-return", "java.lang.Boolean", null, null);
+ data("spring.datasource.schema", "java.lang.String", null, "Schema (DDL) script resource reference.");
+ data("spring.datasource.separator", "java.lang.String", ";", "Statement separator in SQL initialization scripts.");
+ data("spring.datasource.sql-script-encoding", "java.lang.String", null, "SQL scripts encoding.");
+ data("spring.datasource.suspect-timeout", "java.lang.Integer", null, null);
+ data("spring.datasource.test-on-borrow", "java.lang.Boolean", null, null);
+ data("spring.datasource.test-on-connect", "java.lang.Boolean", null, null);
+ data("spring.datasource.test-on-return", "java.lang.Boolean", null, null);
+ data("spring.datasource.test-while-idle", "java.lang.Boolean", null, null);
+ data("spring.datasource.time-between-eviction-runs-millis", "java.lang.Integer", null, null);
+ data("spring.datasource.transaction-isolation", "java.lang.String", null, null);
+ data("spring.datasource.url", "java.lang.String", null, "JDBC url of the database.");
+ data("spring.datasource.use-disposable-connection-facade", "java.lang.Boolean", null, null);
+ data("spring.datasource.use-equals", "java.lang.Boolean", null, null);
+ data("spring.datasource.use-lock", "java.lang.Boolean", null, null);
+ data("spring.datasource.username", "java.lang.String", null, "Login user of the database.");
+ data("spring.datasource.validation-interval", "java.lang.Long", null, null);
+ data("spring.datasource.validation-query", "java.lang.String", null, null);
+ data("spring.datasource.validation-query-timeout", "java.lang.Integer", null, null);
+ data("spring.datasource.validator-class-name", "java.lang.String", null, null);
+ data("spring.datasource.xa.data-source-class-name", "java.lang.String", null, "XA datasource fully qualified name.");
+ data("spring.datasource.xa.properties", "java.util.Map", null, "Properties to pass to the XA data source.");
+ data("spring.freemarker.allow-request-override", "java.lang.Boolean", null, "Set whether HttpServletRequest attributes are allowed to override (hide) controller\n generated model attributes of the same name.");
+ data("spring.freemarker.cache", "java.lang.Boolean", null, "Enable template caching.");
+ data("spring.freemarker.char-set", "java.lang.String", null, null);
+ data("spring.freemarker.charset", "java.lang.String", null, "Template encoding.");
+ data("spring.freemarker.check-template-location", "java.lang.Boolean", null, "Check that the templates location exists.");
+ data("spring.freemarker.content-type", "java.lang.String", null, "Content-Type value.");
+ data("spring.freemarker.enabled", "java.lang.Boolean", null, "Enable MVC view resolution for this technology.");
+ data("spring.freemarker.expose-request-attributes", "java.lang.Boolean", null, "Set whether all request attributes should be added to the model prior to merging\n with the template.");
+ data("spring.freemarker.expose-session-attributes", "java.lang.Boolean", null, "Set whether all HttpSession attributes should be added to the model prior to\n merging with the template.");
+ data("spring.freemarker.expose-spring-macro-helpers", "java.lang.Boolean", null, "Set whether to expose a RequestContext for use by Spring's macro library, under the\n name \"springMacroRequestContext\".");
+ data("spring.freemarker.prefix", "java.lang.String", null, "Prefix that gets prepended to view names when building a URL.");
+ data("spring.freemarker.request-context-attribute", "java.lang.String", null, "Name of the RequestContext attribute for all views.");
+ data("spring.freemarker.settings", "java.util.Map", null, "Well-known FreeMarker keys which will be passed to FreeMarker's Configuration.");
+ data("spring.freemarker.suffix", "java.lang.String", null, "Suffix that gets appended to view names when building a URL.");
+ data("spring.freemarker.template-loader-path", "java.lang.String[]", new String[] {"snuzzle" ,"buggles"}, "Comma-separated list of template paths.");
+ data("spring.freemarker.view-names", "java.lang.String[]", null, "White list of view names that can be resolved.");
+ data("spring.groovy.template.cache", "java.lang.Boolean", null, "Enable template caching.");
+ data("spring.groovy.template.char-set", "java.lang.String", null, null);
+ data("spring.groovy.template.charset", "java.lang.String", null, "Template encoding.");
+ data("spring.groovy.template.check-template-location", "java.lang.Boolean", null, "Check that the templates location exists.");
+ data("spring.groovy.template.configuration.auto-escape", "java.lang.Boolean", null, null);
+ data("spring.groovy.template.configuration.auto-indent", "java.lang.Boolean", null, null);
+ data("spring.groovy.template.configuration.auto-indent-string", "java.lang.String", null, null);
+ data("spring.groovy.template.configuration.auto-new-line", "java.lang.Boolean", null, null);
+ data("spring.groovy.template.configuration.base-template-class", "java.lang.Class extends groovy.text.markup.BaseTemplate>", null, null);
+ data("spring.groovy.template.configuration.cache-templates", "java.lang.Boolean", null, null);
+ data("spring.groovy.template.configuration.declaration-encoding", "java.lang.String", null, null);
+ data("spring.groovy.template.configuration.expand-empty-elements", "java.lang.Boolean", null, null);
+ data("spring.groovy.template.configuration", "java.util.Map", null, "Configuration to pass to TemplateConfiguration.");
+ data("spring.groovy.template.configuration.locale", "java.util.Locale", null, null);
+ data("spring.groovy.template.configuration.new-line-string", "java.lang.String", null, null);
+ data("spring.groovy.template.configuration.resource-loader-path", "java.lang.String", null, null);
+ data("spring.groovy.template.configuration.use-double-quotes", "java.lang.Boolean", null, null);
+ data("spring.groovy.template.content-type", "java.lang.String", null, "Content-Type value.");
+ data("spring.groovy.template.enabled", "java.lang.Boolean", null, "Enable MVC view resolution for this technology.");
+ data("spring.groovy.template.prefix", "java.lang.String", "classpath:/templates/", "Prefix that gets prepended to view names when building a URL.");
+ data("spring.groovy.template.suffix", "java.lang.String", ".tpl", "Suffix that gets appended to view names when building a URL.");
+ data("spring.groovy.template.view-names", "java.lang.String[]", null, "White list of view names that can be resolved.");
+ data("spring.hornetq.embedded.cluster-password", "java.lang.String", null, "Cluster password. Randomly generated on startup by default");
+ data("spring.hornetq.embedded.data-directory", "java.lang.String", null, "Journal file directory. Not necessary if persistence is turned off.");
+ data("spring.hornetq.embedded.enabled", "java.lang.Boolean", "true", "Enable embedded mode if the HornetQ server APIs are available.");
+ data("spring.hornetq.embedded.persistent", "java.lang.Boolean", "false", "Enable persistent store.");
+ data("spring.hornetq.embedded.queues", "java.lang.String[]", "[Ljava.lang.Object;@2f5ce114", "Comma-separate list of queues to create on startup.");
+ data("spring.hornetq.embedded.server-id", "java.lang.Integer", "0", "Server id. By default, an auto-incremented counter is used.");
+ data("spring.hornetq.embedded.topics", "java.lang.String[]", "[Ljava.lang.Object;@6272137a", "Comma-separate list of topics to create on startup.");
+ data("spring.hornetq.host", "java.lang.String", "localhost", "HornetQ broker host.");
+ data("spring.hornetq.mode", "org.springframework.boot.autoconfigure.jms.hornetq.HornetQMode", null, "HornetQ deployment mode, auto-detected by default. Can be explicitly set to\n \"native\" or \"embedded\".");
+ data("spring.hornetq.port", "java.lang.Integer", "5445", "HornetQ broker port.");
+ data("spring.http.encoding.charset", "java.nio.charset.Charset", null, "Charset of HTTP requests and responses. Added to the \"Content-Type\" header if not\n set explicitly.");
+ data("spring.http.encoding.enabled", "java.lang.Boolean", "true", "Enable http encoding support.");
+ data("spring.http.encoding.force", "java.lang.Boolean", "true", "Force the encoding to the configured charset on HTTP requests and responses.");
+ data("spring.jackson.date-format", "java.lang.String", null, "Date format string (yyyy-MM-dd HH:mm:ss), or a fully-qualified date format class\n name.");
+ data("spring.jackson.deserialization", "java.util.Map", null, "Jackson on/off features that affect the way Java objects are deserialized.");
+ data("spring.jackson.generator", "java.util.Map", null, "Jackson on/off features for generators.");
+ data("spring.jackson.mapper", "java.util.Map", null, "Jackson general purpose on/off features.");
+ data("spring.jackson.parser", "java.util.Map", null, "Jackson on/off features for parsers.");
+ data("spring.jackson.property-naming-strategy", "java.lang.String", null, "One of the constants on Jackson's PropertyNamingStrategy\n (CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES). Can also be a fully-qualified class\n name of a PropertyNamingStrategy subclass.");
+ data("spring.jackson.serialization", "java.util.Map", null, "Jackson on/off features that affect the way Java objects are serialized.");
+ data("spring.jersey.filter.order", "java.lang.Integer", "0", "Jersey filter chain order.");
+ data("spring.jersey.init", "java.util.Map", null, "Init parameters to pass to Jersey.");
+ data("spring.jersey.type", "org.springframework.boot.autoconfigure.jersey.JerseyProperties$Type", null, "Jersey integration type. Can be either \"servlet\" or \"filter\".");
+ data("spring.jms.jndi-name", "java.lang.String", null, "Connection factory JNDI name. When set, takes precedence to others connection\n factory auto-configurations.");
+ data("spring.jms.pub-sub-domain", "java.lang.Boolean", "false", "Specify if the default destination type is topic.");
+ data("spring.jmx.enabled", "java.lang.Boolean", "true", "Expose management beans to the JMX domain.");
+ data("spring.jpa.database", "org.springframework.orm.jpa.vendor.Database", null, "Target database to operate on, auto-detected by default. Can be alternatively set\n using the \"databasePlatform\" property.");
+ data("spring.jpa.database-platform", "java.lang.String", null, "Name of the target database to operate on, auto-detected by default. Can be\n alternatively set using the \"Database\" enum.");
+ data("spring.jpa.generate-ddl", "java.lang.Boolean", "false", "Initialize the schema on startup.");
+ data("spring.jpa.hibernate.ddl-auto", "java.lang.String", null, "DDL mode (\"none\", \"validate\", \"update\", \"create\", \"create-drop\"). This is\n actually a shortcut for the \"hibernate.hbm2ddl.auto\" property. Default to\n \"create-drop\" when using an embedded database, \"none\" otherwise.");
+ data("spring.jpa.hibernate.naming-strategy", "java.lang.Class>", null, "Naming strategy fully qualified name.");
+ data("spring.jpa.open-in-view", "java.lang.Boolean", "true", "Register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request.");
+ data("spring.jpa.properties", "java.util.Map", null, "Additional native properties to set on the JPA provider.");
+ data("spring.jpa.show-sql", "java.lang.Boolean", "false", "Enable logging of SQL statements.");
+ data("spring.jta.allow-multiple-lrc", "java.lang.Boolean", null, null);
+ data("spring.jta.asynchronous2-pc", "java.lang.Boolean", null, null);
+ data("spring.jta.background-recovery-interval", "java.lang.Integer", null, null);
+ data("spring.jta.background-recovery-interval-seconds", "java.lang.Integer", null, null);
+ data("spring.jta.current-node-only-recovery", "java.lang.Boolean", null, null);
+ data("spring.jta.debug-zero-resource-transaction", "java.lang.Boolean", null, null);
+ data("spring.jta.default-transaction-timeout", "java.lang.Integer", null, null);
+ data("spring.jta.disable-jmx", "java.lang.Boolean", null, null);
+ data("spring.jta.enabled", "java.lang.Boolean", "true", "Enable JTA support.");
+ data("spring.jta.exception-analyzer", "java.lang.String", null, null);
+ data("spring.jta.filter-log-status", "java.lang.Boolean", null, null);
+ data("spring.jta.force-batching-enabled", "java.lang.Boolean", null, null);
+ data("spring.jta.forced-write-enabled", "java.lang.Boolean", null, null);
+ data("spring.jta.graceful-shutdown-interval", "java.lang.Integer", null, null);
+ data("spring.jta.jndi-transaction-synchronization-registry-name", "java.lang.String", null, null);
+ data("spring.jta.jndi-user-transaction-name", "java.lang.String", null, null);
+ data("spring.jta.journal", "java.lang.String", null, null);
+ data("spring.jta.log-dir", "java.lang.String", null, "Transaction logs directory.");
+ data("spring.jta.log-part1-filename", "java.lang.String", null, null);
+ data("spring.jta.log-part2-filename", "java.lang.String", null, null);
+ data("spring.jta.max-log-size-in-mb", "java.lang.Integer", null, null);
+ data("spring.jta.resource-configuration-filename", "java.lang.String", null, null);
+ data("spring.jta.server-id", "java.lang.String", null, null);
+ data("spring.jta.skip-corrupted-logs", "java.lang.Boolean", null, null);
+ data("spring.jta.transaction-manager-id", "java.lang.String", null, "Transaction manager unique identifier.");
+ data("spring.jta.warn-about-zero-resource-transaction", "java.lang.Boolean", null, null);
+ data("spring.mail.default-encoding", "java.lang.String", "UTF-8", "Default MimeMessage encoding.");
+ data("spring.mail.host", "java.lang.String", null, "SMTP server host.");
+ data("spring.mail.password", "java.lang.String", null, "Login password of the SMTP server.");
+ data("spring.mail.port", "java.lang.Integer", null, "SMTP server port.");
+ data("spring.mail.properties", "java.util.Map", null, "Additional JavaMail session properties.");
+ data("spring.mail.username", "java.lang.String", null, "Login user of the SMTP server.");
+ data("spring.main.show-banner", "java.lang.Boolean", "true", "Display the banner when the application runs.");
+ data("spring.main.sources", "java.util.Set", null, "Sources (class name, package name or XML resource location) used to create the ApplicationContext.");
+ data("spring.main.web-environment", "java.lang.Boolean", null, "Run the application in a web environment (auto-detected by default).");
+ data("spring.mandatory-file-encoding", "java.lang.String", null, "Expected character encoding the application must use.");
+ data("spring.messages.basename", "java.lang.String", "messages", "Comma-separated list of basenames, each following the ResourceBundle convention.\n Essentially a fully-qualified classpath location. If it doesn't contain a package\n qualifier (such as \"org.mypackage\"), it will be resolved from the classpath root.");
+ data("spring.messages.cache-seconds", "java.lang.Integer", "-1", "Loaded resource bundle files cache expiration, in seconds. When set to -1, bundles\n are cached forever.");
+ data("spring.messages.encoding", "java.lang.String", "utf-8", "Message bundles encoding.");
+ data("spring.mobile.devicedelegatingviewresolver.enabled", "java.lang.Boolean", "false", "Enable device view resolver.");
+ data("spring.mobile.devicedelegatingviewresolver.mobile-prefix", "java.lang.String", "mobile/", "Prefix that gets prepended to view names for mobile devices.");
+ data("spring.mobile.devicedelegatingviewresolver.mobile-suffix", "java.lang.String", "", "Suffix that gets appended to view names for mobile devices.");
+ data("spring.mobile.devicedelegatingviewresolver.normal-prefix", "java.lang.String", "", "Prefix that gets prepended to view names for normal devices.");
+ data("spring.mobile.devicedelegatingviewresolver.normal-suffix", "java.lang.String", "", "Suffix that gets appended to view names for normal devices.");
+ data("spring.mobile.devicedelegatingviewresolver.tablet-prefix", "java.lang.String", "tablet/", "Prefix that gets prepended to view names for tablet devices.");
+ data("spring.mobile.devicedelegatingviewresolver.tablet-suffix", "java.lang.String", "", "Suffix that gets appended to view names for tablet devices.");
+ data("spring.mobile.sitepreference.enabled", "java.lang.Boolean", "true", "Enable SitePreferenceHandler.");
+ data("spring.mvc.date-format", "java.lang.String", null, "Date format to use (e.g. dd/MM/yyyy)");
+ data("spring.mvc.ignore-default-model-on-redirect", "java.lang.Boolean", "true", "If the the content of the \"default\" model should be ignored during redirect\n scenarios.");
+ data("spring.mvc.locale", "java.lang.String", null, "Locale to use.");
+ data("spring.mvc.message-codes-resolver-format", "org.springframework.validation.DefaultMessageCodesResolver$Format", null, "Formatting strategy for message codes (PREFIX_ERROR_CODE, POSTFIX_ERROR_CODE).");
+ data("spring.profiles.active", "java.lang.String", null, "Comma-separated list of active profiles. Can be overridden by a command line switch.");
+ data("spring.profiles.include", "java.lang.String", null, "Unconditionally activate the specified comma separated profiles.");
+ data("spring.rabbitmq.addresses", "java.lang.String", null, "Comma-separated list of addresses to which the client should connect to.");
+ data("spring.rabbitmq.dynamic", "java.lang.Boolean", "true", "Create an AmqpAdmin bean.");
+ data("spring.rabbitmq.host", "java.lang.String", "localhost", "RabbitMQ host.");
+ data("spring.rabbitmq.password", "java.lang.String", null, "Login to authenticate against the broker.");
+ data("spring.rabbitmq.port", "java.lang.Integer", "5672", "RabbitMQ port.");
+ data("spring.rabbitmq.username", "java.lang.String", null, "Login user to authenticate to the broker.");
+ data("spring.rabbitmq.virtual-host", "java.lang.String", null, "Virtual host to use when connecting to the broker.");
+ data("spring.redis.database", "java.lang.Integer", "0", "Database index used by the connection factory.");
+ data("spring.redis.host", "java.lang.String", "localhost", "Redis server host.");
+ data("spring.redis.password", "java.lang.String", null, "Login password of the redis server.");
+ data("spring.redis.pool.max-active", "java.lang.Integer", "8", "Max number of connections that can be allocated by the pool at a given time.\n Use a negative value for no limit.");
+ data("spring.redis.pool.max-idle", "java.lang.Integer", "8", "Max number of \"idle\" connections in the pool. Use a negative value to indicate\n an unlimited number of idle connections.");
+ data("spring.redis.pool.max-wait", "java.lang.Integer", "-1", "Maximum amount of time (in milliseconds) a connection allocation should block\n before throwing an exception when the pool is exhausted. Use a negative value\n to block indefinitely.");
+ data("spring.redis.pool.min-idle", "java.lang.Integer", "0", "Target for the minimum number of idle connections to maintain in the pool. This\n setting only has an effect if it is positive.");
+ data("spring.redis.port", "java.lang.Integer", "6379", "Redis server port.");
+ data("spring.redis.sentinel.master", "java.lang.String", null, "Name of Redis server.");
+ data("spring.redis.sentinel.nodes", "java.lang.String", null, "Comma-separated list of host:port pairs.");
+ data("spring.resources.add-mappings", "java.lang.Boolean", "true", "Enable default resource handling.");
+ data("spring.resources.cache-period", "java.lang.Integer", null, "Cache period for the resources served by the resource handler, in seconds.");
+ data("spring.social.auto-connection-views", "java.lang.Boolean", "false", "Enable the connection status view for supported providers.");
+ data("spring.social.facebook.app-id", "java.lang.String", null, "Application id.");
+ data("spring.social.facebook.app-secret", "java.lang.String", null, "Application secret.");
+ data("spring.social.linkedin.app-id", "java.lang.String", null, "Application id.");
+ data("spring.social.linkedin.app-secret", "java.lang.String", null, "Application secret.");
+ data("spring.social.twitter.app-id", "java.lang.String", null, "Application id.");
+ data("spring.social.twitter.app-secret", "java.lang.String", null, "Application secret.");
+ data("spring.thymeleaf.cache", "java.lang.Boolean", "true", "Enable template caching.");
+ data("spring.thymeleaf.check-template-location", "java.lang.Boolean", "true", "Check that the templates location exists.");
+ data("spring.thymeleaf.content-type", "java.lang.String", "text/html", "Content-Type value.");
+ data("spring.thymeleaf.enabled", "java.lang.Boolean", "true", "Enable MVC Thymeleaf view resolution.");
+ data("spring.thymeleaf.encoding", "java.lang.String", "UTF-8", "Template encoding.");
+ data("spring.thymeleaf.excluded-view-names", "java.lang.String[]", null, "Comma-separated list of view names that should be excluded from resolution.");
+ data("spring.thymeleaf.mode", "java.lang.String", "HTML5", "Template mode to be applied to templates. See also StandardTemplateModeHandlers.");
+ data("spring.thymeleaf.prefix", "java.lang.String", "classpath:/templates/", "Prefix that gets prepended to view names when building a URL.");
+ data("spring.thymeleaf.suffix", "java.lang.String", ".html", "Suffix that gets appended to view names when building a URL.");
+ data("spring.thymeleaf.view-names", "java.lang.String[]", null, "Comma-separated list of view names that can be resolved.");
+ data("spring.velocity.allow-request-override", "java.lang.Boolean", null, "Set whether HttpServletRequest attributes are allowed to override (hide) controller\n generated model attributes of the same name.");
+ data("spring.velocity.cache", "java.lang.Boolean", null, "Enable template caching.");
+ data("spring.velocity.char-set", "java.lang.String", null, null);
+ data("spring.velocity.charset", "java.lang.String", null, "Template encoding.");
+ data("spring.velocity.check-template-location", "java.lang.Boolean", null, "Check that the templates location exists.");
+ data("spring.velocity.content-type", "java.lang.String", null, "Content-Type value.");
+ data("spring.velocity.date-tool-attribute", "java.lang.String", null, "Name of the DateTool helper object to expose in the Velocity context of the view.");
+ data("spring.velocity.enabled", "java.lang.Boolean", null, "Enable MVC view resolution for this technology.");
+ data("spring.velocity.expose-request-attributes", "java.lang.Boolean", null, "Set whether all request attributes should be added to the model prior to merging\n with the template.");
+ data("spring.velocity.expose-session-attributes", "java.lang.Boolean", null, "Set whether all HttpSession attributes should be added to the model prior to\n merging with the template.");
+ data("spring.velocity.expose-spring-macro-helpers", "java.lang.Boolean", null, "Set whether to expose a RequestContext for use by Spring's macro library, under the\n name \"springMacroRequestContext\".");
+ data("spring.velocity.number-tool-attribute", "java.lang.String", null, "Name of the NumberTool helper object to expose in the Velocity context of the view.");
+ data("spring.velocity.prefer-file-system-access", "java.lang.Boolean", "true", "Prefer file system access for template loading. File system access enables hot\n detection of template changes.");
+ data("spring.velocity.prefix", "java.lang.String", null, "Prefix that gets prepended to view names when building a URL.");
+ data("spring.velocity.properties", "java.util.Map", null, "Additional velocity properties.");
+ data("spring.velocity.request-context-attribute", "java.lang.String", null, "Name of the RequestContext attribute for all views.");
+ data("spring.velocity.resource-loader-path", "java.lang.String", "classpath:/templates/", "Template path.");
+ data("spring.velocity.suffix", "java.lang.String", null, "Suffix that gets appended to view names when building a URL.");
+ data("spring.velocity.toolbox-config-location", "java.lang.String", null, "Velocity Toolbox config location, for example \"/WEB-INF/toolbox.xml\". Automatically\n loads a Velocity Tools toolbox definition file and expose all defined tools in the\n specified scopes.");
+ data("spring.velocity.view-names", "java.lang.String[]", null, "White list of view names that can be resolved.");
+ data("spring.view.prefix", "java.lang.String", null, "Spring MVC view prefix.");
+ data("spring.view.suffix", "java.lang.String", null, "Spring MVC view suffix.");
+ }
+
+ public boolean isEmpty() {
+ return datas == null || datas.isEmpty();
+ }
+
+ public SpringPropertyIndexProvider getIndexProvider() {
+ return indexProvider;
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/.gitignore b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/.gitignore
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/.gitignore
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/.gitignore
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/.mvn/wrapper/maven-wrapper.jar b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/.mvn/wrapper/maven-wrapper.jar
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/.mvn/wrapper/maven-wrapper.jar
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/.mvn/wrapper/maven-wrapper.jar
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/.mvn/wrapper/maven-wrapper.properties b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/.mvn/wrapper/maven-wrapper.properties
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/.mvn/wrapper/maven-wrapper.properties
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/.mvn/wrapper/maven-wrapper.properties
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/mvnw b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/mvnw
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/mvnw
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/mvnw
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/mvnw.cmd b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/mvnw.cmd
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/mvnw.cmd
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/mvnw.cmd
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/pom.xml b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/pom.xml
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/pom.xml
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/pom.xml
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/src/main/java/org/test/TestScopeAnnotationApplication.java b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestAnnotationsApplication.java
similarity index 64%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/src/main/java/org/test/TestScopeAnnotationApplication.java
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestAnnotationsApplication.java
index 90fb713da..3780b4b75 100644
--- a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/src/main/java/org/test/TestScopeAnnotationApplication.java
+++ b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestAnnotationsApplication.java
@@ -4,9 +4,9 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
-public class TestScopeAnnotationApplication {
+public class TestAnnotationsApplication {
public static void main(String[] args) {
- SpringApplication.run(TestScopeAnnotationApplication.class, args);
+ SpringApplication.run(TestAnnotationsApplication.class, args);
}
}
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/src/main/java/org/test/TestScopeCompletion.java b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestScopeCompletion.java
similarity index 100%
rename from vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-scope-annotation/src/main/java/org/test/TestScopeCompletion.java
rename to vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestScopeCompletion.java
diff --git a/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestValueCompletion.java b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestValueCompletion.java
new file mode 100644
index 000000000..ba853018a
--- /dev/null
+++ b/vscode-extensions/vscode-boot-java/src/test/resources/test-projects/test-annotations/src/main/java/org/test/TestValueCompletion.java
@@ -0,0 +1,17 @@
+package org.test;
+
+import org.springframework.beans.factory.annotation.Value;
+
+public class TestValueCompletion {
+
+ @Value("onField")
+ private String value1;
+
+ @Value("onMethod")
+ public void method1() {
+ }
+
+ public void method2(@Value("onParameter") String parameter1) {
+ }
+
+}
diff --git a/vscode-extensions/vscode-boot-properties/pom.xml b/vscode-extensions/vscode-boot-properties/pom.xml
index 5c8aff563..badc4a90a 100644
--- a/vscode-extensions/vscode-boot-properties/pom.xml
+++ b/vscode-extensions/vscode-boot-properties/pom.xml
@@ -53,6 +53,11 @@
commons-maven
${project.version}
+
+ org.springframework.ide.vscode
+ commons-gradle
+ ${project.version}
+
org.springframework.ide.vscode
commons-language-server
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java
index dd3132a00..067c2c145 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/BootPropertiesLanguageServer.java
@@ -18,12 +18,13 @@ import org.springframework.ide.vscode.boot.common.RelaxedNameConfig;
import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtilProvider;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.boot.properties.completions.SpringPropertiesCompletionEngine;
import org.springframework.ide.vscode.boot.properties.hover.PropertiesHoverInfoProvider;
import org.springframework.ide.vscode.boot.properties.reconcile.SpringPropertiesReconcileEngine;
import org.springframework.ide.vscode.boot.yaml.completions.ApplicationYamlAssistContext;
import org.springframework.ide.vscode.boot.yaml.reconcile.ApplicationYamlReconcileEngine;
+import org.springframework.ide.vscode.commons.gradle.GradleCore;
+import org.springframework.ide.vscode.commons.gradle.GradleProjectFinderStrategy;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionEngine;
import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter;
import org.springframework.ide.vscode.commons.languageserver.hover.HoverInfoProvider;
@@ -36,7 +37,9 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcil
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
import org.springframework.ide.vscode.commons.maven.JavaProjectWithClasspathFileFinderStrategy;
+import org.springframework.ide.vscode.commons.maven.MavenCore;
import org.springframework.ide.vscode.commons.maven.MavenProjectFinderStrategy;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.text.IDocument;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
import org.springframework.ide.vscode.commons.yaml.ast.YamlASTProvider;
@@ -60,7 +63,8 @@ import com.google.common.collect.ImmutableList;
public class BootPropertiesLanguageServer extends SimpleLanguageServer {
public static final JavaProjectFinder DEFAULT_PROJECT_FINDER = new DefaultJavaProjectFinder(new IJavaProjectFinderStrategy[] {
- new MavenProjectFinderStrategy(),
+ new MavenProjectFinderStrategy(MavenCore.getDefault()),
+ new GradleProjectFinderStrategy(GradleCore.getDefault()),
new JavaProjectWithClasspathFileFinderStrategy()
});
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/CommonLanguageTools.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/CommonLanguageTools.java
index 1b75f4878..661e2c7b2 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/CommonLanguageTools.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/CommonLanguageTools.java
@@ -26,11 +26,11 @@ import org.springframework.ide.vscode.boot.metadata.types.Type;
import org.springframework.ide.vscode.boot.metadata.types.TypeParser;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil.EnumCaseMode;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.boot.properties.reconcile.PropertyNavigator;
import org.springframework.ide.vscode.commons.languageserver.LanguageIds;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.util.CollectionUtil;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/PropertyCompletionFactory.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/PropertyCompletionFactory.java
index 5ef8fe78d..0d84eb5b9 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/PropertyCompletionFactory.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/common/PropertyCompletionFactory.java
@@ -16,11 +16,11 @@ import org.springframework.ide.vscode.boot.metadata.types.Type;
import org.springframework.ide.vscode.boot.metadata.types.TypeParser;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil;
import org.springframework.ide.vscode.boot.metadata.types.TypedProperty;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap.Match;
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
import org.springframework.ide.vscode.commons.languageserver.completion.ScoreableProposal;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
+import org.springframework.ide.vscode.commons.util.FuzzyMap.Match;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.text.IDocument;
import org.springframework.ide.vscode.commons.yaml.hover.YPropertyInfoTemplates;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/ClassReferenceProvider.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/ClassReferenceProvider.java
index 7a25628b2..2618837bc 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/ClassReferenceProvider.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/ClassReferenceProvider.java
@@ -131,11 +131,11 @@ public class ClassReferenceProvider extends CachingValueProvider {
@Override
protected Flux getValuesAsync(IJavaProject javaProject, String query) {
- IType targetType = target == null || target.isEmpty() ? javaProject.findType("java.lang.Object") : javaProject.findType(target);
+ IType targetType = target == null || target.isEmpty() ? javaProject.getClasspath().findType("java.lang.Object") : javaProject.getClasspath().findType(target);
if (targetType == null) {
return Flux.empty();
}
- Set allSubclasses = javaProject
+ Set allSubclasses = javaProject.getClasspath()
.allSubtypesOf(targetType)
.filter(t -> Flags.isPublic(t.getFlags()) && !concrete || !isAbstract(t))
.collect(Collectors.toSet())
@@ -143,7 +143,7 @@ public class ClassReferenceProvider extends CachingValueProvider {
if (allSubclasses.isEmpty()) {
return Flux.empty();
} else {
- return javaProject
+ return javaProject.getClasspath()
.fuzzySearchTypes(query, type -> allSubclasses.contains(type))
.collectSortedList((o1, o2) -> o2.getT2().compareTo(o1.getT2()))
.flatMap(l -> Flux.fromIterable(l))
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java
index 6434fb19b..685fc56f9 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/DefaultSpringPropertyIndexProvider.java
@@ -11,13 +11,15 @@
package org.springframework.ide.vscode.boot.metadata;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.ProgressService;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.text.IDocument;
public class DefaultSpringPropertyIndexProvider implements SpringPropertyIndexProvider {
+
+ private static final FuzzyMap EMPTY_INDEX = new SpringPropertyIndex(null, null);
private JavaProjectFinder javaProjectFinder;
private SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(ValueProviderRegistry.getDefault());
@@ -34,7 +36,7 @@ public class DefaultSpringPropertyIndexProvider implements SpringPropertyIndexPr
if (jp!=null) {
return indexManager.get(jp, progressService);
}
- return null;
+ return EMPTY_INDEX;
}
public void setProgressService(ProgressService progressService) {
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/IndexNavigator.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/IndexNavigator.java
index cd19604c6..ffa4f3b6a 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/IndexNavigator.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/IndexNavigator.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.springframework.ide.vscode.boot.metadata;
-import static org.springframework.ide.vscode.commons.util.StringUtil.*;
+import static org.springframework.ide.vscode.commons.util.StringUtil.hasText;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap.Match;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.FuzzyMap.Match;
import org.springframework.ide.vscode.commons.util.StringUtil;
/**
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/LoggerNameProvider.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/LoggerNameProvider.java
index e3fd3ee6e..2f9886766 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/LoggerNameProvider.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/LoggerNameProvider.java
@@ -37,10 +37,10 @@ public class LoggerNameProvider extends CachingValueProvider {
@Override
protected Flux getValuesAsync(IJavaProject javaProject, String query) {
return Flux.concat(
- javaProject
+ javaProject.getClasspath()
.fuzzySearchPackages(query)
.map(t -> Tuples.of(StsValueHint.create(t.getT1()), t.getT2())),
- javaProject
+ javaProject.getClasspath()
.fuzzySearchTypes(query, null)
.map(t -> Tuples.of(StsValueHint.create(t.getT1()), t.getT2()))
)
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java
index d88075998..79830ab41 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertiesIndexManager.java
@@ -13,11 +13,11 @@ package org.springframework.ide.vscode.boot.metadata;
import java.util.HashMap;
import java.util.Map;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.boot.metadata.util.Listener;
import org.springframework.ide.vscode.boot.metadata.util.ListenerManager;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.ProgressService;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
/**
* Support for Reconciling, Content Assist and Hover Text in spring properties
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java
index b21ed7bef..cc6f74e01 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndex.java
@@ -17,8 +17,8 @@ import org.springframework.boot.configurationmetadata.ConfigurationMetadataGroup
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataSource;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.commons.java.IClasspath;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.StringUtil;
public class SpringPropertyIndex extends FuzzyMap {
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java
index 41f750fb0..daad71928 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/SpringPropertyIndexProvider.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.springframework.ide.vscode.boot.metadata;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.text.IDocument;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/hints/StsValueHint.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/hints/StsValueHint.java
index c3f088792..8845e0013 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/hints/StsValueHint.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/hints/StsValueHint.java
@@ -79,7 +79,7 @@ public class StsValueHint {
try {
IJavaProject jp = typeUtil.getJavaProject();
if (jp!=null) {
- IType type = jp.findType(fqName);
+ IType type = jp.getClasspath().findType(fqName);
if (type!=null) {
return create(type);
}
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypeUtil.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypeUtil.java
index 0a5377962..07bb5c158 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypeUtil.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypeUtil.java
@@ -543,7 +543,7 @@ public class TypeUtil {
private IType findType(String typeName) {
try {
if (javaProject!=null) {
- return javaProject.findType(typeName);
+ return javaProject.getClasspath().findType(typeName);
}
} catch (Exception e) {
Log.log(e);
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/completions/PropertiesCompletionProposalsCalculator.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/completions/PropertiesCompletionProposalsCalculator.java
index 1d28fae29..2b6ff9e5e 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/completions/PropertiesCompletionProposalsCalculator.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/completions/PropertiesCompletionProposalsCalculator.java
@@ -11,7 +11,11 @@
package org.springframework.ide.vscode.boot.properties.completions;
-import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.*;
+import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.SPACES;
+import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.findLongestValidProperty;
+import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.getValueHints;
+import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.getValueType;
+import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.isValuePrefixChar;
import static org.springframework.ide.vscode.commons.util.StringUtil.camelCaseToHyphens;
import java.util.ArrayList;
@@ -28,11 +32,9 @@ import org.springframework.ide.vscode.boot.metadata.hints.ValueHintHoverInfo;
import org.springframework.ide.vscode.boot.metadata.types.Type;
import org.springframework.ide.vscode.boot.metadata.types.TypeParser;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil;
-import org.springframework.ide.vscode.boot.metadata.types.TypedProperty;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil.BeanPropertyNameMode;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil.EnumCaseMode;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap.Match;
+import org.springframework.ide.vscode.boot.metadata.types.TypedProperty;
import org.springframework.ide.vscode.boot.properties.reconcile.PropertyNavigator;
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
@@ -41,6 +43,8 @@ import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion
import org.springframework.ide.vscode.commons.languageserver.util.PrefixFinder;
import org.springframework.ide.vscode.commons.util.BadLocationException;
import org.springframework.ide.vscode.commons.util.CollectionUtil;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.FuzzyMap.Match;
import org.springframework.ide.vscode.commons.util.FuzzyMatcher;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.text.IDocument;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/hover/PropertiesHoverCalculator.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/hover/PropertiesHoverCalculator.java
index 603c5f1ea..cfdb1dc2c 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/hover/PropertiesHoverCalculator.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/hover/PropertiesHoverCalculator.java
@@ -29,10 +29,10 @@ import org.springframework.ide.vscode.boot.metadata.hints.StsValueHint;
import org.springframework.ide.vscode.boot.metadata.types.Type;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil.EnumCaseMode;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.util.BadLocationException;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.text.IDocument;
import org.springframework.ide.vscode.commons.util.text.IRegion;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/reconcile/SpringPropertiesReconcileEngine.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/reconcile/SpringPropertiesReconcileEngine.java
index 06df1224f..7a19d1d46 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/reconcile/SpringPropertiesReconcileEngine.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/properties/reconcile/SpringPropertiesReconcileEngine.java
@@ -25,12 +25,12 @@ import org.springframework.ide.vscode.boot.metadata.types.Type;
import org.springframework.ide.vscode.boot.metadata.types.TypeParser;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtilProvider;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.boot.properties.quickfix.ReplaceDeprecatedPropertyQuickfix;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.util.BadLocationException;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.ValueParser;
import org.springframework.ide.vscode.commons.util.text.IDocument;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/completions/ApplicationYamlAssistContext.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/completions/ApplicationYamlAssistContext.java
index 4e75f3eca..1c7948bc3 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/completions/ApplicationYamlAssistContext.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/completions/ApplicationYamlAssistContext.java
@@ -17,7 +17,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.stream.Stream;
import org.springframework.boot.configurationmetadata.Deprecation;
import org.springframework.ide.vscode.boot.common.InformationTemplates;
@@ -34,8 +33,6 @@ import org.springframework.ide.vscode.boot.metadata.types.TypeUtil;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil.BeanPropertyNameMode;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtil.EnumCaseMode;
import org.springframework.ide.vscode.boot.metadata.types.TypedProperty;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap.Match;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IJavaElement;
import org.springframework.ide.vscode.commons.java.IMember;
@@ -46,6 +43,8 @@ import org.springframework.ide.vscode.commons.languageserver.completion.LazyProp
import org.springframework.ide.vscode.commons.languageserver.completion.ScoreableProposal;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.util.CollectionUtil;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
+import org.springframework.ide.vscode.commons.util.FuzzyMap.Match;
import org.springframework.ide.vscode.commons.util.FuzzyMatcher;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.Renderable;
diff --git a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/reconcile/ApplicationYamlReconcileEngine.java b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/reconcile/ApplicationYamlReconcileEngine.java
index 1835a1682..f7670fe3f 100644
--- a/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/reconcile/ApplicationYamlReconcileEngine.java
+++ b/vscode-extensions/vscode-boot-properties/src/main/java/org/springframework/ide/vscode/boot/yaml/reconcile/ApplicationYamlReconcileEngine.java
@@ -16,9 +16,9 @@ import org.springframework.ide.vscode.boot.metadata.IndexNavigator;
import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
import org.springframework.ide.vscode.boot.metadata.types.TypeUtilProvider;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblem;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.text.IDocument;
import org.springframework.ide.vscode.commons.yaml.ast.YamlASTProvider;
import org.springframework.ide.vscode.commons.yaml.reconcile.YamlASTReconciler;
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java
index 0a727548d..4b74d7e51 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java
+++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java
@@ -22,9 +22,9 @@ import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndex;
import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
import org.springframework.ide.vscode.boot.metadata.ValueProviderRegistry;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.commons.java.IClasspath;
import org.springframework.ide.vscode.commons.java.IJavaProject;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.commons.util.text.IDocument;
/**
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/PropertiesIndexTest.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/PropertiesIndexTest.java
index 4fd9ae0b4..f0df01135 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/PropertiesIndexTest.java
+++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/PropertiesIndexTest.java
@@ -15,12 +15,9 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
-import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
-import org.springframework.ide.vscode.boot.metadata.SpringPropertiesIndexManager;
-import org.springframework.ide.vscode.boot.metadata.ValueProviderRegistry;
-import org.springframework.ide.vscode.boot.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.ProgressService;
+import org.springframework.ide.vscode.commons.util.FuzzyMap;
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
/**
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/TypeUtilTest.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/TypeUtilTest.java
index 139e550e6..40f29fe16 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/TypeUtilTest.java
+++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/metadata/TypeUtilTest.java
@@ -68,8 +68,8 @@ public class TypeUtilTest {
@Test
public void testGetProperties() throws Exception {
useProject("enums-boot-1.3.2-app");
- assertNotNull(project.findType("demo.Color"));
- assertNotNull(project.findType("demo.ColorData"));
+ assertNotNull(project.getClasspath().findType("demo.Color"));
+ assertNotNull(project.getClasspath().findType("demo.ColorData"));
Type data = TypeParser.parse("demo.ColorData");
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationPropertiesEditorTest.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationPropertiesEditorTest.java
index 5ea78f46f..0c6320e80 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationPropertiesEditorTest.java
+++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationPropertiesEditorTest.java
@@ -214,7 +214,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Test public void testPredefinedProject() throws Exception {
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
- IType type = p.findType("demo.DemoApplication");
+ IType type = p.getClasspath().findType("demo.DemoApplication");
assertNotNull(type);
}
@@ -223,7 +223,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
//Check some assumptions about the initial state of the test project (if these checks fail then
// the test may be 'vacuous' since the things we are testing for already exist beforehand.
- Path metadataFile = p.getOutputFolder().resolve(PropertiesLoader.PROJECT_META_DATA_LOCATIONS[0]);
+ Path metadataFile = p.getClasspath().getOutputFolder().resolve(PropertiesLoader.PROJECT_META_DATA_LOCATIONS[0]);
assertTrue(metadataFile.toFile().isFile());
assertContains("\"name\": \"foo.counter\"", Files.toString(metadataFile.toFile(), Charset.forName("UTF8")));
}
@@ -288,7 +288,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
- assertNotNull(p.findType("demo.Foo"));
+ assertNotNull(p.getClasspath().findType("demo.Foo"));
Editor editor = newEditor(
"token.bad.guy=problem\n"+
@@ -313,7 +313,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
- assertNotNull(p.findType("demo.Foo"));
+ assertNotNull(p.getClasspath().findType("demo.Foo"));
assertCompletionsVariations("volder.foo.l<*>", "volder.foo.list[<*>");
assertCompletionsDisplayStringAndDetail("volder.foo.list[0].<*>",
@@ -462,7 +462,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.colors", "java.util.List", null, "A foonky list");
@@ -485,7 +485,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.color", "demo.Color", null, "A foonky colour");
@@ -504,7 +504,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.color", "demo.Color", null, "A foonky colour");
Editor editor = newEditor(
@@ -527,7 +527,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
assertCompletionsVariations("foo.nam<*>",
"foo.name-colors.<*>",
@@ -546,7 +546,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
useProject(p);
data("foo.name-colors", "java.util.Map", null, "Map with colors in its values");
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
Editor editor = newEditor(
"foo.name-colors.jacket=BLUE\n" +
@@ -565,8 +565,8 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
useProject(p);
data("foo.color-names", "java.util.Map", null, "Map with colors in its keys");
data("foo.color-data", "java.util.Map", null, "Map with colors in its keys, and pojo in values");
- assertNotNull(p.findType("demo.Color"));
- assertNotNull(p.findType("demo.ColorData"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.ColorData"));
//Map Enum -> String:
assertCompletionsVariations("foo.colnam<*>", "foo.color-names.<*>");
@@ -605,8 +605,8 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
- assertNotNull(p.findType("demo.ColorData"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.ColorData"));
Editor editor = newEditor(
"foo.color-names.RED=Rood\n"+
@@ -625,8 +625,8 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
- assertNotNull(p.findType("demo.ColorData"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.ColorData"));
assertCompletion("foo.dat<*>", "foo.data.<*>");
@@ -660,8 +660,8 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
- assertNotNull(p.findType("demo.ColorData"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.ColorData"));
Editor editor = newEditor(
"foo.data.bogus=Something\n" +
@@ -695,8 +695,8 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
- assertNotNull(p.findType("demo.ColorData"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.ColorData"));
data("atommap", "java.util.Map", null, "map of atomic data");
data("objectmap", "java.util.Map", null, "map of atomic object (recursive map)");
@@ -735,8 +735,8 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
- assertNotNull(p.findType("demo.ColorData"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.ColorData"));
Editor editor = newEditor(
"foo.color-names.BLUE.dot=Blauw\n"+
@@ -761,7 +761,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.ClothingSize"));
+ assertNotNull(p.getClasspath().findType("demo.ClothingSize"));
data("simple.pants.size", "demo.ClothingSize", null, "The simple pant's size");
@@ -805,7 +805,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.ClothingSize"));
+ assertNotNull(p.getClasspath().findType("demo.ClothingSize"));
data("simple.pants.size", "demo.ClothingSize", null, "The simple pant's size");
@@ -1400,7 +1400,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
data("my.colors", "java.util.List", null, "Ooh! nice colors!");
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationYamlEditorTest.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationYamlEditorTest.java
index 860baf75d..f42afb166 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationYamlEditorTest.java
+++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/test/ApplicationYamlEditorTest.java
@@ -545,7 +545,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
@Test public void testReconcileBeanPropName() throws Exception {
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
- assertNotNull(p.findType("demo.Foo"));
+ assertNotNull(p.getClasspath().findType("demo.Foo"));
data("some-foo", "demo.Foo", null, "some Foo pojo property");
Editor editor = newEditor(
"some-foo:\n" +
@@ -577,7 +577,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
@Test public void testReconcilePojoArray() throws Exception {
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
- assertNotNull(p.findType("demo.Foo"));
+ assertNotNull(p.getClasspath().findType("demo.Foo"));
{
Editor editor = newEditor(
@@ -654,7 +654,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
@Test public void testEnumPropertyReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.Color"));
+ assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.color", "demo.Color", null, "A foonky colour");
Editor editor = newEditor(
@@ -1846,7 +1846,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testEnumsInLowerCaseContentAssist() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
- assertNotNull(p.findType("demo.ClothingSize"));
+ assertNotNull(p.getClasspath().findType("demo.ClothingSize"));
data("simple.pants.size", "demo.ClothingSize", null, "The simple pant's size");
diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java
index 56fda5153..bde1c3f47 100644
--- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java
+++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/project/harness/ProjectsHarness.java
@@ -52,7 +52,7 @@ public class ProjectsHarness {
switch (type) {
case MAVEN:
MavenBuilder.newBuilder(testProjectPath).clean().pack().javadoc().skipTests().execute();
- return new MavenJavaProject(testProjectPath.resolve(MavenCore.POM_XML).toFile());
+ return new MavenJavaProject(MavenCore.getDefault(), testProjectPath.resolve(MavenCore.POM_XML).toFile());
case CLASSPATH_TXT:
MavenBuilder.newBuilder(testProjectPath).clean().pack().skipTests().execute();
return new JavaProjectWithClasspathFile(testProjectPath.resolve(MavenCore.CLASSPATH_TXT).toFile());
diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlCFDomainsProvider.java b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlCFDomainsProvider.java
new file mode 100644
index 000000000..4617dbcf9
--- /dev/null
+++ b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlCFDomainsProvider.java
@@ -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.ide.vscode.manifest.yaml;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.springframework.ide.vscode.commons.cloudfoundry.client.CFDomain;
+import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget;
+import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTargetCache;
+import org.springframework.ide.vscode.commons.yaml.schema.BasicYValueHint;
+import org.springframework.ide.vscode.commons.yaml.schema.YValueHint;
+
+public class ManifestYamlCFDomainsProvider extends AbstractCFHintsProvider {
+
+ public ManifestYamlCFDomainsProvider(CFTargetCache cache) {
+ super(cache);
+ }
+
+ @Override
+ public Collection getHints(List targets) throws Exception {
+
+ List hints = new ArrayList<>();
+
+ for (CFTarget cfTarget : targets) {
+
+ List domains = cfTarget.getDomains();
+ if (domains != null && !domains.isEmpty()) {
+
+ for (CFDomain domain : domains) {
+ String name = domain.getName();
+ String label = getLabel(cfTarget, domain);
+ YValueHint hint = new BasicYValueHint(name, label);
+ if (!hints.contains(hint)) {
+ hints.add(hint);
+ }
+ }
+ return hints;
+ }
+ }
+ // Contract for the reconciler: return null if values cannot be
+ // resolved. Otherwise
+ // return non-empty list
+ return !hints.isEmpty() ? hints : null;
+ }
+
+ protected String getLabel(CFTarget target, CFDomain domain) {
+ return domain.getName();
+ }
+
+ @Override
+ protected String getTypeName() {
+ return "Domain";
+ }
+}
diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlLanguageServer.java b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlLanguageServer.java
index f1fe59da7..bce95e518 100644
--- a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlLanguageServer.java
+++ b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlLanguageServer.java
@@ -63,10 +63,7 @@ public class ManifestYamlLanguageServer extends SimpleLanguageServer {
YamlASTProvider parser = new YamlParser(yaml);
- Callable> buildPacksProvider = getBuildpacksProvider();
- Callable> servicesProvider = getServicesProvider();
-
- schema = new ManifestYmlSchema(buildPacksProvider, servicesProvider);
+ schema = new ManifestYmlSchema(getHintProviders());
YamlStructureProvider structureProvider = YamlStructureProvider.DEFAULT;
YamlAssistContextProvider contextProvider = new SchemaBasedYamlAssistContextProvider(schema);
@@ -98,6 +95,30 @@ public class ManifestYamlLanguageServer extends SimpleLanguageServer {
documents.onHover(hoverEngine ::getHover);
}
+ protected ManifestYmlHintProviders getHintProviders() {
+ Callable> buildPacksProvider = getBuildpacksProvider();
+ Callable> servicesProvider = getServicesProvider();
+ Callable> domainsProvider = getDomainsProvider();
+
+ return new ManifestYmlHintProviders() {
+
+ @Override
+ public Callable> getServicesProvider() {
+ return servicesProvider;
+ }
+
+ @Override
+ public Callable> getDomainsProvider() {
+ return domainsProvider;
+ }
+
+ @Override
+ public Callable> getBuildpackProviders() {
+ return buildPacksProvider;
+ }
+ };
+ }
+
private CFTargetCache getCfTargetCache() {
if (cfTargetCache == null) {
ClientParamsProvider paramsProvider = cfParamsProvider;
@@ -114,6 +135,10 @@ public class ManifestYamlLanguageServer extends SimpleLanguageServer {
private Callable> getServicesProvider() {
return new ManifestYamlCFServicesProvider(getCfTargetCache());
}
+
+ private Callable> getDomainsProvider() {
+ return new ManifestYamlCFDomainsProvider(getCfTargetCache());
+ }
@Override
protected ServerCapabilities getServerCapabilities() {
diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlHintProviders.java b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlHintProviders.java
new file mode 100644
index 000000000..09558ba5b
--- /dev/null
+++ b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlHintProviders.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.ide.vscode.manifest.yaml;
+
+import java.util.Collection;
+import java.util.concurrent.Callable;
+
+import org.springframework.ide.vscode.commons.yaml.schema.YValueHint;
+
+public interface ManifestYmlHintProviders {
+
+ Callable> getBuildpackProviders();
+
+ Callable> getServicesProvider();
+
+ Callable> getDomainsProvider();
+
+}
diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java
index 8f2e0f722..1974ca8c5 100644
--- a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java
+++ b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java
@@ -22,6 +22,7 @@ import org.springframework.ide.vscode.commons.yaml.schema.YType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YAtomicType;
+import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YBeanType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YTypedPropertyImpl;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeUtil;
import org.springframework.ide.vscode.commons.yaml.schema.YValueHint;
@@ -47,8 +48,13 @@ public class ManifestYmlSchema implements YamlSchema {
return IntegerRange.exactly(1);
}
- public ManifestYmlSchema(Callable> buildpackProvider, Callable> servicesProvider) {
- this.buildpackProvider = buildpackProvider;
+
+ public ManifestYmlSchema(ManifestYmlHintProviders providers) {
+ this.buildpackProvider = providers.getBuildpackProviders();
+ Callable> servicesProvider = providers.getServicesProvider();
+ Callable> domainsProvider = providers.getDomainsProvider();
+
+
YTypeFactory f = new YTypeFactory();
TYPE_UTIL = f.TYPE_UTIL;
@@ -63,7 +69,17 @@ public class ManifestYmlSchema implements YamlSchema {
t_buildpack.addHintProvider(this.buildpackProvider);
// t_buildpack.parseWith(ManifestYmlValueParsers.fromHints(t_buildpack.toString(), buildpackProvider));
}
+
+ YAtomicType t_domain = f.yatomic("Domain");
+ YAtomicType t_domains_string = f.yatomic("Domains");
+ if (domainsProvider != null) {
+ t_domain.addHintProvider(domainsProvider);
+ t_domains_string.addHintProvider(domainsProvider);
+ }
+
+ YType t_domains = f.yseq(t_domains_string);
+
YAtomicType t_service_string = f.yatomic("Service");
if (servicesProvider != null) {
t_service_string.addHintProvider(servicesProvider);
@@ -78,6 +94,13 @@ public class ManifestYmlSchema implements YamlSchema {
YType t_string = f.yatomic("String");
YType t_strings = f.yseq(t_string);
+ // "routes" has nested required property "route":
+ // routes:
+ // - route: someroute.io
+
+ YBeanType route = f.ybean("Route");
+ route.addProperty(f.yprop("route", t_string).isRequired(true));
+
YAtomicType t_memory = f.yatomic("Memory");
t_memory.addHints("256M", "512M", "1024M");
t_memory.parseWith(ManifestYmlValueParsers.MEMORY);
@@ -112,8 +135,8 @@ public class ManifestYmlSchema implements YamlSchema {
f.yprop("buildpack", t_buildpack),
f.yprop("command", t_string),
f.yprop("disk_quota", t_memory),
- f.yprop("domain", t_string),
- f.yprop("domains", t_strings),
+ f.yprop("domain", t_domain),
+ f.yprop("domains", t_domains),
f.yprop("env", t_env),
f.yprop("host", t_string),
f.yprop("hosts", t_strings),
@@ -124,6 +147,7 @@ public class ManifestYmlSchema implements YamlSchema {
f.yprop("no-route", t_boolean),
f.yprop("path", t_path),
f.yprop("random-route", t_boolean),
+ f.yprop("routes", f.yseq(route)),
f.yprop("services", t_services),
f.yprop("stack", t_string),
f.yprop("timeout", t_pos_integer),
diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html
new file mode 100644
index 000000000..49b219ea2
--- /dev/null
+++ b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html
@@ -0,0 +1,12 @@
+Use the routes attribute to provide multiple HTTP and TCP routes. Each route for this app is created if it does not already exist.
+This attribute is a combination of push options that include --hostname, -d, and --route-path.
+
+---
+ ...
+ routes:
+ - route: example.com
+ - route: www.example.com/foo
+ - route: tcp-example.com:1234
+
+
+The routes attribute cannot be used in conjunction with the following attributes: host, hosts, domain, domains, and no-hostname. An error will result.
diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md
new file mode 100644
index 000000000..754921e46
--- /dev/null
+++ b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md
@@ -0,0 +1,14 @@
+Use the `routes` attribute to provide multiple HTTP and TCP routes. Each route for this app is created if it does not already exist.
+
+This attribute is a combination of `push` options that include `--hostname`, `-d`, and `--route-path`.
+
+```
+---
+ ...
+ routes:
+ - route: example.com
+ - route: www.example.com/foo
+ - route: tcp-example.com:1234
+```
+
+The `routes` attribute cannot be used in conjunction with the following attributes: `host`, `hosts`, `domain`, `domains`, and `no-hostname`. An error will result.
\ No newline at end of file
diff --git a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java
index 4444cf279..8534b6806 100644
--- a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java
+++ b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Pivotal, Inc.
+f * Copyright (c) 2016, 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
@@ -25,6 +25,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack;
+import org.springframework.ide.vscode.commons.cloudfoundry.client.CFDomain;
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance;
import org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests;
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException;
@@ -278,6 +279,9 @@ public class ManifestYamlEditorTest {
// ---------------
"random-route: <*>",
// ---------------
+ "routes:\n"+
+ "- <*>",
+ // ---------------
"services:\n"+
"- <*>",
// ---------------
@@ -353,6 +357,10 @@ public class ManifestYamlEditorTest {
"- random-route: <*>",
// ---------------
"applications:\n" +
+ "- routes:\n"+
+ " - <*>",
+ // ---------------
+ "applications:\n" +
"- services:\n"+
" - <*>",
// ---------------
@@ -431,6 +439,8 @@ public class ManifestYamlEditorTest {
" no-route: true\n" +
" path: somepath/app.jar\n" +
" random-route: true\n" +
+ " routes:\n" +
+ " - route: tcp-example.com:1234\n" +
" services:\n" +
" - instance_ABC\n" +
" - instance_XYZ\n" +
@@ -456,6 +466,7 @@ public class ManifestYamlEditorTest {
editor.assertIsHoverRegion("no-route");
editor.assertIsHoverRegion("path");
editor.assertIsHoverRegion("random-route");
+ editor.assertIsHoverRegion("routes");
editor.assertIsHoverRegion("services");
editor.assertIsHoverRegion("stack");
editor.assertIsHoverRegion("timeout");
@@ -478,6 +489,7 @@ public class ManifestYamlEditorTest {
editor.assertHoverContains("no-route", "You can use the `no-route` attribute with a value of `true` to prevent a route from being created for your application");
editor.assertHoverContains("path", "You can use the `path` attribute to tell Cloud Foundry where to find your application");
editor.assertHoverContains("random-route", "Use the `random-route` attribute to create a URL that includes the app name and random words");
+ editor.assertHoverContains("routes", "Each route for this app is created if it does not already exist");
editor.assertHoverContains("services", "The `services` block consists of a heading, then one or more service instance names");
editor.assertHoverContains("stack", "Use the `stack` attribute to specify which stack to deploy your application to.");
editor.assertHoverContains("timeout", "The `timeout` attribute defines the number of seconds Cloud Foundry allocates for starting your application");
@@ -595,6 +607,10 @@ public class ManifestYamlEditorTest {
"- random-route: <*>",
// ---------------
"applications:\n" +
+ "- routes:\n"+
+ " - <*>",
+ // ---------------
+ "applications:\n" +
"- services:\n"+
" - <*>",
// ---------------
@@ -679,6 +695,11 @@ public class ManifestYamlEditorTest {
"- name: test"
, // ---------------------
"applications:\n" +
+ "- routes:\n" +
+ " - <*>\n" +
+ "- name: test"
+ ,// ---------------------
+ "applications:\n" +
"- services:\n" +
" - <*>\n" +
"- name: test"
@@ -936,6 +957,44 @@ public class ManifestYamlEditorTest {
when(cfClient.getBuildpacks()).thenReturn(ImmutableList.of(buildPack));
assertDoesNotContainCompletions("buildpack: <*>", "buildpack: wrong_buildpack<*>");
}
+
+ @Test
+ public void domainContentAssist() throws Exception {
+ ClientRequests cfClient = cloudfoundry.client;
+ CFDomain domain = Mockito.mock(CFDomain.class);
+ when(domain.getName()).thenReturn("cfapps.io");
+ when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
+
+ assertContainsCompletions("domain: <*>", "domain: cfapps.io<*>");
+ }
+
+ @Test
+ public void domainContentAssistDoesNotContainCompletion() throws Exception {
+ ClientRequests cfClient = cloudfoundry.client;
+ CFDomain domain = Mockito.mock(CFDomain.class);
+ when(domain.getName()).thenReturn("cfapps.io");
+ when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
+ assertDoesNotContainCompletions("domain: <*>", "domain: wrong.cfapps.io<*>");
+ }
+
+ @Test
+ public void domainsContentAssist() throws Exception {
+ ClientRequests cfClient = cloudfoundry.client;
+ CFDomain domain = Mockito.mock(CFDomain.class);
+ when(domain.getName()).thenReturn("cfapps.io");
+ when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
+
+ assertContainsCompletions("domains:\n" + " - <*>", "cfapps.io");
+ }
+
+ @Test
+ public void domainsContentAssistWrongDomain() throws Exception {
+ ClientRequests cfClient = cloudfoundry.client;
+ CFDomain domain = Mockito.mock(CFDomain.class);
+ when(domain.getName()).thenReturn("cfapps.io");
+ when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
+ assertDoesNotContainCompletions("domains:\n" + " - <*>", "wrong.cfapps.io");
+ }
//////////////////////////////////////////////////////////////////////////////
diff --git a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java
index 5d7af42c8..1c98a65bd 100644
--- a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java
+++ b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java
@@ -14,13 +14,16 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.Callable;
import org.junit.Test;
import org.springframework.ide.vscode.commons.util.Renderables;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.commons.yaml.schema.YTypedProperty;
+import org.springframework.ide.vscode.commons.yaml.schema.YValueHint;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YSeqType;
import org.springframework.ide.vscode.manifest.yaml.ManifestYmlSchema;
@@ -52,6 +55,7 @@ public class ManifestYmlSchemaTest {
"no-route",
"path",
"random-route",
+ "routes",
"services",
"stack",
"timeout"
@@ -76,12 +80,13 @@ public class ManifestYmlSchemaTest {
"no-route",
"path",
"random-route",
+ "routes",
"services",
"stack",
"timeout"
};
- ManifestYmlSchema schema = new ManifestYmlSchema(null, null);
+ ManifestYmlSchema schema = new ManifestYmlSchema(EMPTY_PROVIDERS);
@Test
public void toplevelProperties() throws Exception {
@@ -150,5 +155,22 @@ public class ManifestYmlSchemaTest {
}
return builder.build();
}
-
+
+ private static final ManifestYmlHintProviders EMPTY_PROVIDERS = new ManifestYmlHintProviders() {
+
+ @Override
+ public Callable> getServicesProvider() {
+ return null;
+ }
+
+ @Override
+ public Callable> getDomainsProvider() {
+ return null;
+ }
+
+ @Override
+ public Callable> getBuildpackProviders() {
+ return null;
+ }
+ };
}