Merge branch 'master' of github.com:spring-projects/sts4

This commit is contained in:
Kris De Volder
2016-12-07 09:59:39 -08:00
18 changed files with 257 additions and 166 deletions

View File

@@ -1,75 +1,70 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>application-properties-metadata</artifactId>
<description>Builds metadata for boot application properties based on project's classpath contents</description>
<repositories>
<repository>
<id>project-repo</id>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
<dependencies>
<!-- Local modified JSON lib packaged to support order in maps -->
<dependency>
<groupId>org.springframework.ide.eclipse</groupId>
<artifactId>org.json</artifactId>
<version>1.0</version>
</dependency>
<!-- Guava collections -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!-- Javax Inject -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Reactor -->
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor-version}</version>
</dependency>
<!-- Common Utilities -->
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-yaml</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-java</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-language-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>project-test-harness</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>application-properties-metadata</artifactId>
<description>Builds metadata for boot application properties based on project's classpath contents</description>
<repositories>
<repository>
<id>project-repo</id>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
<dependencies>
<!-- Local modified JSON lib packaged to support order in maps -->
<dependency>
<groupId>org.springframework.ide.eclipse</groupId>
<artifactId>org.json</artifactId>
<version>1.0</version>
</dependency>
<!-- Guava collections -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!-- Javax Inject -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Reactor -->
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor-version}</version>
</dependency>
<!-- Common Utilities -->
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-yaml</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-java</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>project-test-harness</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -3,7 +3,7 @@ package org.springframework.ide.vscode.languageserver.testharness;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.*;
import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.assertContains;
import java.util.ArrayList;
import java.util.Collections;
@@ -24,10 +24,8 @@ import org.eclipse.lsp4j.PublishDiagnosticsParams;
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.TextEdit;
import org.junit.Assert;
import org.springframework.ide.vscode.commons.util.Log;
import com.google.common.base.Strings;
import com.google.gson.internal.Streams;
public class Editor {
@@ -206,7 +204,6 @@ public class Editor {
: "";
}
@SuppressWarnings("unchecked")
private List<Diagnostic> reconcile() {
// We assume the language server works synchronously for now and it does an immediate reconcile
// when the document changes. In the future this is probably not going to be the case though and then this
@@ -351,7 +348,9 @@ public class Editor {
if (expectDetail!=null) {
assertEquals(expectDetail, it.getDetail());
}
assertContains(expectDocSnippet, it.getDocumentation());
if (expectDocSnippet!=null) {
assertContains(expectDocSnippet, it.getDocumentation());
}
}
protected CompletionItem assertCompletionWithLabel(String expectLabel) throws Exception {

View File

@@ -1,5 +1,6 @@
package org.springframework.ide.vscode.properties.editor.test.harness;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -102,23 +103,20 @@ public abstract class AbstractPropsEditorTest {
harness.assertCompletionDisplayString(editorContents, expected);
}
private void notImplemented() {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Checks that completions contains a completion with a given display string and that that completion
* has a info hover that contains a given snippet of text.
* <p>
* Deprecated: use assertCompletionDetails instead and also check add an expected 'detail' text of
* completion item.
*/
@Deprecated
public void assertCompletionWithInfoHover(String editorText, String expectLabel, String expectInfoSnippet) throws Exception {
Editor editor = newEditor(editorText);
editor.assertCompletionDetails(expectLabel, null, expectInfoSnippet);
}
/**
* Checks that completions contains a completion with a given display string, detail and documentation text
*/
public void assertCompletionDetails(String editorText, String expectLabel, String expectDetail, String expectDocumenation) throws Exception {
Editor editor = newEditor(editorText);
editor.assertCompletionDetails(expectLabel, expectDetail, expectDocumenation);
}
public boolean isEmptyMetadata() {
return md.isEmpty();
}
@@ -174,6 +172,25 @@ public abstract class AbstractPropsEditorTest {
}
assertElements(actualLabels, completionsLabels);
}
public void assertCompletionsDisplayStringAndDetail(String editorText, String[]...expectCompletions) throws Exception {
String[] completionsLabels = new String[expectCompletions.length];
String[] completionDetails = new String[expectCompletions.length];
for (int i = 0; i < expectCompletions.length; i++) {
completionsLabels[i] = expectCompletions[i][0];
completionDetails[i] = expectCompletions[i][1];
}
Editor editor = newEditor(editorText);
List<CompletionItem> completions = editor.getCompletions();
String[] actualLabels = new String[completions.size()];
String[] actualDetails = new String[completions.size()];
for (int i = 0; i < completions.size(); i++) {
actualLabels[i] = completions.get(i).getLabel();
actualDetails[i] = completions.get(i).getDetail();
}
assertElements(actualLabels, completionsLabels);
assertArrayEquals(actualDetails, completionDetails);
}
public SpringPropertyIndexProvider getIndexProvider() {
return md.getIndexProvider();

View File

@@ -15,10 +15,10 @@ import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.TextDocumentSyncKind;
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.application.properties.metadata.SpringPropertyIndexProvider;
import org.springframework.ide.vscode.application.properties.metadata.completions.PropertyCompletionFactory;
import org.springframework.ide.vscode.application.properties.metadata.completions.RelaxedNameConfig;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtilProvider;
import org.springframework.ide.vscode.application.properties.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
import org.springframework.ide.vscode.boot.common.RelaxedNameConfig;
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;

View File

@@ -8,7 +8,7 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.application.properties.metadata.completions;
package org.springframework.ide.vscode.boot.common;
import org.eclipse.lsp4j.CompletionItemKind;
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;

View File

@@ -8,7 +8,7 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.properties.tools;
package org.springframework.ide.vscode.boot.common;
import static org.springframework.ide.vscode.commons.util.Renderables.*;
@@ -32,19 +32,25 @@ public abstract class AbstractPropertyRenderableProvider {
if (type==null) {
type = Object.class.getName();
}
renderableBuilder.add(lineBreak());
actionLink(renderableBuilder, type);
String deflt = formatDefaultValue(getDefaultValue());
if (deflt!=null) {
renderableBuilder.add(lineBreak());
renderableBuilder.add(lineBreak());
defaultValueRenderable(renderableBuilder, deflt);
}
if (isDeprecated()) {
renderableBuilder.add(lineBreak());
renderableBuilder.add(lineBreak());
depreactionRenderable(renderableBuilder);
}
Renderable description = getDescription();
if (description!=null) {
renderableBuilder.add(lineBreak());
descriptionRenderable(renderableBuilder, description);
}
@@ -97,20 +103,15 @@ public abstract class AbstractPropertyRenderableProvider {
* link then the provided runnable is to be executed.
*/
public void actionLink(Builder<Renderable> renderableBuilder, String displayString) {
renderableBuilder.add(lineBreak());
renderableBuilder.add(link(displayString, "null"));
}
private void defaultValueRenderable(Builder<Renderable> renderableBuilder, String defaultValue) {
renderableBuilder.add(lineBreak());
renderableBuilder.add(lineBreak());
protected void defaultValueRenderable(Builder<Renderable> renderableBuilder, String defaultValue) {
renderableBuilder.add(text("Default: "));
renderableBuilder.add(italic(text(defaultValue)));
}
private void depreactionRenderable(Builder<Renderable> renderableBuilder) {
renderableBuilder.add(lineBreak());
renderableBuilder.add(lineBreak());
protected void depreactionRenderable(Builder<Renderable> renderableBuilder) {
String reason = getDeprecationReason();
if (StringUtil.hasText(reason)) {
renderableBuilder.add(bold(text("Deprecated: ")));
@@ -120,8 +121,7 @@ public abstract class AbstractPropertyRenderableProvider {
}
}
private void descriptionRenderable(Builder<Renderable> renderableBuilder, Renderable description) {
renderableBuilder.add(lineBreak());
protected void descriptionRenderable(Builder<Renderable> renderableBuilder, Renderable description) {
renderableBuilder.add(paragraph(description));
}

View File

@@ -1,4 +1,4 @@
package org.springframework.ide.vscode.boot.properties.tools;
package org.springframework.ide.vscode.boot.common;
import static org.springframework.ide.vscode.commons.util.StringUtil.camelCaseToHyphens;

View File

@@ -8,11 +8,10 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.application.properties.metadata.completions;
package org.springframework.ide.vscode.boot.common;
import org.eclipse.lsp4j.CompletionItemKind;
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.application.properties.metadata.hints.ValueHintHoverInfo;
import org.springframework.ide.vscode.application.properties.metadata.types.Type;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeParser;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil;
@@ -27,6 +26,9 @@ import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.yaml.hover.YPropertyHoverInfo;
import org.springframework.ide.vscode.commons.yaml.schema.YType;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
public class PropertyCompletionFactory {
public ICompletionProposal valueProposal(String value, String query, String niceTypeName, double score, DocumentEdits edits, Renderable info) {
@@ -103,7 +105,7 @@ public class PropertyCompletionFactory {
@Override
public String getLabel() {
return getBaseDisplayString() + " : " + typeUtil.niceTypeName(getType());
return getBaseDisplayString();
}
@@ -124,22 +126,19 @@ public class PropertyCompletionFactory {
private Match<PropertyInfo> match;
private Type type;
private TypeUtil typeUtil;
private Supplier<PropertyRenderableProvider> propertyRenderable;
public PropertyProposal(IDocument doc, DocumentEdits applier, Match<PropertyInfo> match,
TypeUtil typeUtil) {
super(doc, applier);
this.typeUtil = typeUtil;
this.match = match;
this.propertyRenderable = Suppliers.memoize(() -> new ShortDocumentationRenderableProvider(documentContextFinder.find(fDoc), match.data));
if (match.data.isDeprecated()) {
deprecate();
}
}
// @Override
// public HoverInfo getAdditionalProposalInfo(IProgressMonitor monitor) {
// return new SpringPropertyHoverInfo(documentContextFinder.getJavaProject(fDoc), match.data);
// }
@Override
protected String getBaseDisplayString() {
return match.data.getId();
@@ -175,9 +174,7 @@ public class PropertyCompletionFactory {
@Override
public Renderable getDocumentation() {
//TODO: See org.springframework.ide.eclipse.boot.properties.editor.completions.SpringPropertyHoverInfo in old code on how
// this used to render docs.
return null;
return propertyRenderable.get().getRenderable();
}
}

View File

@@ -8,7 +8,7 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.boot.properties.tools;
package org.springframework.ide.vscode.boot.common;
import java.util.ArrayList;
import java.util.Collections;

View File

@@ -1,4 +1,4 @@
package org.springframework.ide.vscode.application.properties.metadata.completions;
package org.springframework.ide.vscode.boot.common;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil.BeanPropertyNameMode;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil.EnumCaseMode;

View File

@@ -0,0 +1,50 @@
package org.springframework.ide.vscode.boot.common;
import static org.springframework.ide.vscode.commons.util.Renderables.concat;
import static org.springframework.ide.vscode.commons.util.Renderables.lineBreak;
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.util.Renderable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
public class ShortDocumentationRenderableProvider extends PropertyRenderableProvider {
public ShortDocumentationRenderableProvider(IJavaProject project, PropertyInfo data) {
super(project, data);
}
@Override
public Renderable getRenderable() {
Builder<Renderable> renderableBuilder = ImmutableList.builder();
Renderable description = getDescription();
if (description!=null) {
descriptionRenderable(renderableBuilder, description);
}
String deflt = formatDefaultValue(getDefaultValue());
if (deflt!=null) {
if (description != null) {
renderableBuilder.add(lineBreak());
}
defaultValueRenderable(renderableBuilder, deflt);
}
if (isDeprecated()) {
if (description != null) {
renderableBuilder.add(lineBreak());
}
depreactionRenderable(renderableBuilder);
}
ImmutableList<Renderable> pieces = renderableBuilder.build();
return pieces.isEmpty() ? null : concat(pieces);
}
}

View File

@@ -1,6 +1,6 @@
package org.springframework.ide.vscode.boot.properties.completions;
import static org.springframework.ide.vscode.boot.properties.tools.CommonLanguageTools.*;
import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.*;
import static org.springframework.ide.vscode.commons.util.StringUtil.camelCaseToHyphens;
import java.util.ArrayList;
@@ -9,7 +9,6 @@ import java.util.Collections;
import java.util.List;
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.application.properties.metadata.completions.PropertyCompletionFactory;
import org.springframework.ide.vscode.application.properties.metadata.hints.HintProvider;
import org.springframework.ide.vscode.application.properties.metadata.hints.HintProviders;
import org.springframework.ide.vscode.application.properties.metadata.hints.StsValueHint;
@@ -22,6 +21,7 @@ import org.springframework.ide.vscode.application.properties.metadata.types.Type
import org.springframework.ide.vscode.application.properties.metadata.types.TypedProperty;
import org.springframework.ide.vscode.application.properties.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.application.properties.metadata.util.FuzzyMap.Match;
import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
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;

View File

@@ -3,8 +3,8 @@ package org.springframework.ide.vscode.boot.properties.completions;
import java.util.Collection;
import org.springframework.ide.vscode.application.properties.metadata.SpringPropertyIndexProvider;
import org.springframework.ide.vscode.application.properties.metadata.completions.PropertyCompletionFactory;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtilProvider;
import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionEngine;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;

View File

@@ -1,8 +1,8 @@
package org.springframework.ide.vscode.boot.properties.hover;
import static org.springframework.ide.vscode.boot.properties.tools.CommonLanguageTools.SPACES;
import static org.springframework.ide.vscode.boot.properties.tools.CommonLanguageTools.getValueHints;
import static org.springframework.ide.vscode.boot.properties.tools.CommonLanguageTools.getValueType;
import static org.springframework.ide.vscode.boot.common.CommonLanguageTools.SPACES;
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.commons.util.Renderables.*;
import java.util.Collection;
@@ -15,7 +15,7 @@ import org.springframework.ide.vscode.application.properties.metadata.types.Type
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil.EnumCaseMode;
import org.springframework.ide.vscode.application.properties.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.boot.properties.tools.PropertyRenderableProvider;
import org.springframework.ide.vscode.boot.common.PropertyRenderableProvider;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.util.BadLocationException;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;

View File

@@ -20,8 +20,6 @@ import java.util.Set;
import org.springframework.ide.vscode.application.properties.metadata.IndexNavigator;
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.application.properties.metadata.completions.PropertyCompletionFactory;
import org.springframework.ide.vscode.application.properties.metadata.completions.RelaxedNameConfig;
import org.springframework.ide.vscode.application.properties.metadata.hints.HintProvider;
import org.springframework.ide.vscode.application.properties.metadata.hints.StsValueHint;
import org.springframework.ide.vscode.application.properties.metadata.hints.ValueHintHoverInfo;
@@ -33,7 +31,9 @@ import org.springframework.ide.vscode.application.properties.metadata.types.Type
import org.springframework.ide.vscode.application.properties.metadata.types.TypedProperty;
import org.springframework.ide.vscode.application.properties.metadata.util.FuzzyMap;
import org.springframework.ide.vscode.application.properties.metadata.util.FuzzyMap.Match;
import org.springframework.ide.vscode.boot.properties.tools.PropertyRenderableProvider;
import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
import org.springframework.ide.vscode.boot.common.PropertyRenderableProvider;
import org.springframework.ide.vscode.boot.common.RelaxedNameConfig;
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.LazyProposalApplier;

View File

@@ -22,7 +22,7 @@ import org.springframework.ide.vscode.application.properties.metadata.types.Type
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil.BeanPropertyNameMode;
import org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil.EnumCaseMode;
import org.springframework.ide.vscode.boot.properties.tools.AbstractPropertyRenderableProvider;
import org.springframework.ide.vscode.boot.common.AbstractPropertyRenderableProvider;
import org.springframework.ide.vscode.application.properties.metadata.types.TypedProperty;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IJavaElement;

View File

@@ -70,7 +70,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Test public void testServerPortCompletion() throws Exception {
data("server.port", INTEGER, 8080, "Port where server listens for http.");
assertCompletion("ser<*>", "server.port=<*>");
assertCompletionDisplayString("ser<*>", "server.port");
assertCompletionDetails("ser<*>", "server.port", "int", null);
}
@Test public void testLoggingLevelCompletion() throws Exception {
@@ -318,10 +318,11 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
assertNotNull(p.findType("demo.Foo"));
assertCompletionsVariations("volder.foo.l<*>", "volder.foo.list[<*>");
assertCompletionsDisplayString("volder.foo.list[0].<*>",
"name : String",
"description : String",
"roles : List<String>");
assertCompletionsDisplayStringAndDetail("volder.foo.list[0].<*>",
new String[] {"description", "String"},
new String[] {"name", "String"},
new String[] {"roles", "List<String>"}
);
assertCompletionsVariations("volder.foo.list[0].na<*>",
"volder.foo.list[0].name=<*>"
@@ -576,8 +577,10 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
"foo.color-names.green=<*>",
"foo.color-names.red=<*>"
);
assertCompletionsDisplayString("foo.color-names.<*>",
"red : String", "green : String", "blue : String"
assertCompletionsDisplayStringAndDetail("foo.color-names.<*>",
new String[] {"blue", "String"},
new String[] {"green", "String"},
new String[] {"red", "String"}
);
assertCompletionsVariations("foo.color-names.B<*>",
"foo.color-names.BLUE=<*>"
@@ -593,8 +596,10 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
assertCompletionsVariations("foo.color-data.B<*>",
"foo.color-data.BLUE.<*>"
);
assertCompletionsDisplayString("foo.color-data.<*>",
"blue : demo.ColorData", "green : demo.ColorData", "red : demo.ColorData"
assertCompletionsDisplayStringAndDetail("foo.color-data.<*>",
new String[] {"blue", "demo.ColorData"},
new String[] {"green", "demo.ColorData"},
new String[] {"red", "demo.ColorData"}
);
}
@@ -627,16 +632,16 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
assertCompletion("foo.dat<*>", "foo.data.<*>");
assertCompletionsDisplayString("foo.data.",
"wavelen : double",
"name : String",
"next : demo.Color[BLUE, GREEN, RED]",
"nested : demo.ColorData",
"children : List<demo.ColorData>",
"mapped-children : Map<String, demo.ColorData>",
"color-children : Map<demo.Color[BLUE, GREEN, RED], demo.ColorData>",
"tags : List<String>",
"funky : boolean"
assertCompletionsDisplayStringAndDetail("foo.data.",
new String[] {"children", "List<demo.ColorData>"},
new String[] {"color-children", "Map<demo.Color[BLUE, GREEN, RED], demo.ColorData>"},
new String[] {"funky", "boolean"},
new String[] {"mapped-children", "Map<String, demo.ColorData>"},
new String[] {"name", "String"},
new String[] {"nested", "demo.ColorData"},
new String[] {"next", "demo.Color[BLUE, GREEN, RED]"},
new String[] {"tags", "List<String>"},
new String[] {"wavelen", "double"}
);
assertCompletionsVariations("foo.data.wav<*>", "foo.data.wavelen=<*>");
@@ -1099,26 +1104,29 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
assertCompletionWithLabel(
"logging.level.<*>"
, //==============
"root : String",
"root",
//=>
"logging.level.root=<*>"
);
assertCompletionDetails("logging.level.<*>", "root", "String", null);
assertCompletionWithLabel(
"logging.level.r<*>"
, //==============
"root : String",
"root",
//=>
"logging.level.root=<*>"
);
assertCompletionDetails("logging.level.r<*>", "root", "String", null);
assertCompletionWithLabel(
"logging.level.ot<*>"
, //==============
"root : String",
"root",
//=>
"logging.level.root=<*>"
);
assertCompletionDetails("logging.level.ot<*>", "root", "String", null);
}
@Test public void testHandleAsResourceContentAssist() throws Exception {
@@ -1508,15 +1516,16 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testEnumJavaDocShownInValueContentAssist() throws Exception {
@Test public void testEnumJavaDocShownInValueContentAssist() throws Exception {
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.background", "demo.Color", null, "Color to use as default background.");
assertCompletionWithInfoHover(
assertCompletionDetails(
"my.background=<*>"
, // ==========
"red"
, // ==>
"demo.Color[BLUE, GREEN, RED]",
"Hot and delicious"
);
}

View File

@@ -24,7 +24,6 @@ import org.springframework.ide.vscode.application.properties.metadata.CachingVal
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.boot.BootPropertiesLanguageServer;
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.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.languageserver.testharness.Editor;
@@ -42,8 +41,6 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
////////////////////////////////////////////////////////////////////////////////////////
private JavaProjectFinder javaProjectFinder;
@Test public void linterRunsOnDocumentOpenAndChange() throws Exception {
Editor editor = newEditor(
"somemap: val\n"+
@@ -139,7 +136,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
editor.assertHoverContains("INDENT_OUTPUT", "allows enabling (or disabling) indentation");
}
@Ignore @Test public void testHoverInfoForEnumValueInMapKeyCompletion() throws Exception {
@Test public void testHoverInfoForEnumValueInMapKeyCompletion() throws Exception {
IJavaProject project = createPredefinedMavenProject("empty-boot-1.3.0-app");
useProject(project);
@@ -151,30 +148,32 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
// System.out.println(downloadSources(type));
// System.out.println("<<< source for: "+type.getFullyQualifiedName());
assertCompletionWithInfoHover(
assertCompletionDetails(
"spring:\n" +
" jackson:\n" +
" serialization:\n" +
" ind<*>"
, // ==========
"indent-output : boolean"
"indent-output"
, // ==>
"boolean",
"allows enabling (or disabling) indentation"
);
}
@Ignore @Test public void testHoverInfoForValueHintCompletion() throws Exception {
@Test public void testHoverInfoForValueHintCompletion() throws Exception {
data("my.bonus", "java.lang.String", null, "Bonus type")
.valueHint("small", "A small bonus. For a little extra incentive.")
.valueHint("large", "An large bonus. For the ones who deserve it.")
.valueHint("exorbitant", "Truly outrageous. Who deserves a bonus like that?");
assertCompletionWithInfoHover(
assertCompletionDetails(
"my:\n" +
" bonus: l<*>"
, // ==========
"large"
, // ==>
"String",
"For the ones who deserve it"
);
}
@@ -2992,12 +2991,21 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
" level:\n" +
" <*>"
, // =>
"root : String"
"root"
,
"logging:\n" +
" level:\n" +
" root: <*>"
);
assertCompletionDetails(
"logging:\n" +
" level:\n" +
" <*>"
, // =>
"root",
"String",
null
);
}
@Test public void testEscapeStringValueStartingWithStar() throws Exception {
@@ -3067,12 +3075,18 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
" level:\n" +
" boot.auto<*>"
, //-----------------
"org.springframework.boot.autoconfigure : String"
"org.springframework.boot.autoconfigure"
, // =>
"logging:\n" +
" level:\n" +
" org.springframework.boot.autoconfigure: <*>"
);
assertCompletionDetails(
"logging:\n" +
" level:\n" +
" boot.auto<*>"
, //-----------------
"org.springframework.boot.autoconfigure", "String", null);
//Finds a type:
assertCompletionWithLabel(
@@ -3080,12 +3094,21 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
" level:\n" +
" MesgSource<*>"
, //-----------------
"org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration : String"
"org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration"
, // =>
"logging:\n" +
" level:\n" +
" org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration: <*>"
);
assertCompletionDetails(
"logging:\n" +
" level:\n" +
" MesgSource<*>"
, //-----------------
"org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration",
"String",
null
);
}
@Test public void testSimpleResourceCompletion() throws Exception {
@@ -3432,16 +3455,17 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testEnumJavaDocShownInValueContentAssist() throws Exception {
@Test public void testEnumJavaDocShownInValueContentAssist() throws Exception {
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.background", "demo.Color", null, "Color to use as default background.");
assertCompletionWithInfoHover(
assertCompletionDetails(
"my:\n" +
" background: <*>"
, // ==========
"red"
, // ==>
"demo.Color[BLUE, GREEN, RED]",
"Hot and delicious"
);
}