PT #135782951: (Part 1) Completions for deprecated properties
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016-2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2019 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
|
||||
@@ -40,4 +40,6 @@ public interface ICompletionProposal {
|
||||
|
||||
default InsertTextFormat getInsertTextFormat() { return InsertTextFormat.Snippet; }
|
||||
|
||||
default boolean isDeprecated() { return false; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2019 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
|
||||
@@ -178,6 +178,9 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
|
||||
item.setSortText(sortkeys.next());
|
||||
item.setFilterText(completion.getFilterText());
|
||||
item.setDetail(completion.getDetail());
|
||||
if (completion.isDeprecated()) {
|
||||
item.setDeprecated(completion.isDeprecated());
|
||||
}
|
||||
resolveEdits(doc, completion, item); //Warning. Its not allowed by LSP spec to resolveEdits
|
||||
//lazy as we used to do in the past.
|
||||
if (resolver!=null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016-2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2019 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
|
||||
@@ -668,6 +668,18 @@ public class Editor {
|
||||
return it;
|
||||
}
|
||||
|
||||
public CompletionItem assertCompletionDetailsWithDeprecation(String expectLabel, String expectDetail, String expectDocSnippet, Boolean deprecated) throws Exception {
|
||||
CompletionItem it = harness.resolveCompletionItem(assertCompletionWithLabel(expectLabel));
|
||||
if (expectDetail!=null) {
|
||||
assertEquals(expectDetail, it.getDetail());
|
||||
}
|
||||
if (expectDocSnippet!=null) {
|
||||
assertContains(expectDocSnippet, getDocString(it));
|
||||
}
|
||||
assertEquals(deprecated, it.getDeprecated());
|
||||
return it;
|
||||
}
|
||||
|
||||
protected CompletionItem assertCompletionWithLabel(Predicate<String> expectLabel) throws Exception {
|
||||
List<CompletionItem> completions = getCompletions();
|
||||
Optional<CompletionItem> completion = completions.stream()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2016 Pivotal, Inc.
|
||||
* Copyright (c) 2015, 2019 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
|
||||
@@ -72,7 +72,8 @@ public abstract class AbstractPropertyProposal extends ScoreableProposal {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
protected boolean isDeprecated() {
|
||||
@Override
|
||||
public boolean isDeprecated() {
|
||||
return isDeprecated;
|
||||
}
|
||||
public void deprecate() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016-2017 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2019 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
|
||||
@@ -32,76 +32,87 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableList.Builder;
|
||||
|
||||
public class InformationTemplates {
|
||||
|
||||
|
||||
private static final String ARROW = "\u2192";
|
||||
|
||||
public static Renderable createHover(PropertyInfo info) {
|
||||
Deprecation deprecation = createDeprecation(info);
|
||||
Renderable description = info.getDescription() == null ? null : text(info.getDescription());
|
||||
return InformationTemplates.createHover(info.getId(), info.getType(), info.getDefaultValue(), description, deprecation);
|
||||
}
|
||||
|
||||
|
||||
public static Renderable createCompletionDocumentation(PropertyInfo info) {
|
||||
Deprecation deprecation = createDeprecation(info);
|
||||
Renderable description = info.getDescription() == null ? null : text(info.getDescription());
|
||||
return InformationTemplates.createCompletionDocumentation(description, info.getDefaultValue(), deprecation);
|
||||
return InformationTemplates.createCompletionDocumentation(info.getId(), description, info.getDefaultValue(), deprecation);
|
||||
}
|
||||
|
||||
|
||||
public static Renderable createHover(String id, String type, Object defaultValue, Renderable description, Deprecation deprecation) {
|
||||
Builder<Renderable> renderableBuilder = ImmutableList.builder();
|
||||
|
||||
renderId(renderableBuilder, id, deprecation);
|
||||
|
||||
|
||||
if (type==null) {
|
||||
type = Object.class.getName();
|
||||
}
|
||||
renderableBuilder.add(lineBreak());
|
||||
actionLink(renderableBuilder, type);
|
||||
|
||||
|
||||
String deflt = formatDefaultValue(defaultValue);
|
||||
if (deflt!=null) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
renderableBuilder.add(lineBreak());
|
||||
defaultValueRenderable(renderableBuilder, deflt);
|
||||
}
|
||||
|
||||
|
||||
if (deprecation != null) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
renderableBuilder.add(lineBreak());
|
||||
depreactionRenderable(renderableBuilder, deprecation);
|
||||
}
|
||||
|
||||
if (description!=null) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
descriptionRenderable(renderableBuilder, description);
|
||||
}
|
||||
|
||||
return concat(renderableBuilder.build());
|
||||
}
|
||||
|
||||
public static Renderable createCompletionDocumentation(Renderable description, Object defaultValue, Deprecation deprecation) {
|
||||
Builder<Renderable> renderableBuilder = ImmutableList.builder();
|
||||
|
||||
if (description!=null) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
descriptionRenderable(renderableBuilder, description);
|
||||
}
|
||||
|
||||
|
||||
return concat(renderableBuilder.build());
|
||||
}
|
||||
|
||||
public static Renderable createCompletionDocumentation(String id, Renderable description, Object defaultValue, Deprecation deprecation) {
|
||||
Builder<Renderable> renderableBuilder = ImmutableList.builder();
|
||||
|
||||
boolean idInserted = false;
|
||||
if (deprecation != null && deprecation.getReplacement() != null) {
|
||||
renderId(renderableBuilder, id, deprecation);
|
||||
idInserted = true;
|
||||
}
|
||||
|
||||
if (description!=null) {
|
||||
if (idInserted) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
}
|
||||
descriptionRenderable(renderableBuilder, description);
|
||||
}
|
||||
|
||||
String deflt = formatDefaultValue(defaultValue);
|
||||
if (deflt!=null) {
|
||||
if (description != null) {
|
||||
if (idInserted || description != null) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
}
|
||||
defaultValueRenderable(renderableBuilder, deflt);
|
||||
}
|
||||
|
||||
|
||||
if (deprecation != null) {
|
||||
if (description != null) {
|
||||
if (idInserted || description != null) {
|
||||
renderableBuilder.add(lineBreak());
|
||||
}
|
||||
depreactionRenderable(renderableBuilder, deprecation);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ImmutableList<Renderable> pieces = renderableBuilder.build();
|
||||
|
||||
|
||||
// Special case when there is no description, default value and deprecation data -> return `null` documentation.
|
||||
if (pieces.size() == 1 && pieces.get(0) == Renderables.NO_DESCRIPTION) {
|
||||
pieces = ImmutableList.of();
|
||||
@@ -109,7 +120,7 @@ public class InformationTemplates {
|
||||
return pieces.isEmpty() ? null : concat(pieces);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Deprecation createDeprecation(PropertyInfo info) {
|
||||
Deprecation deprecation = null;
|
||||
if (info.isDeprecated()) {
|
||||
@@ -119,7 +130,7 @@ public class InformationTemplates {
|
||||
}
|
||||
return deprecation;
|
||||
}
|
||||
|
||||
|
||||
private static void renderId(Builder<Renderable> renderableBuilder, String id, Deprecation deprecation) {
|
||||
if (deprecation == null) {
|
||||
renderableBuilder.add(bold(text(id)));
|
||||
@@ -127,11 +138,11 @@ public class InformationTemplates {
|
||||
renderableBuilder.add(strikeThrough(text(id)));
|
||||
String replacement = deprecation.getReplacement();
|
||||
if (StringUtil.hasText(replacement)) {
|
||||
renderableBuilder.add(text(" -> " + replacement));
|
||||
renderableBuilder.add(text(" " + ARROW + " " + replacement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String formatDefaultValue(Object defaultValue) {
|
||||
if (defaultValue!=null) {
|
||||
if (defaultValue instanceof String) {
|
||||
@@ -159,24 +170,24 @@ public class InformationTemplates {
|
||||
private static void actionLink(Builder<Renderable> renderableBuilder, String displayString) {
|
||||
renderableBuilder.add(link(displayString, "null"));
|
||||
}
|
||||
|
||||
|
||||
private static void defaultValueRenderable(Builder<Renderable> renderableBuilder, String defaultValue) {
|
||||
renderableBuilder.add(text("Default: "));
|
||||
renderableBuilder.add(italic(text(defaultValue)));
|
||||
}
|
||||
|
||||
|
||||
private static void depreactionRenderable(Builder<Renderable> renderableBuilder, Deprecation deprecation) {
|
||||
String reason = deprecation.getReason();
|
||||
if (StringUtil.hasText(reason)) {
|
||||
renderableBuilder.add(bold(text("Deprecated: ")));
|
||||
renderableBuilder.add(text(reason));
|
||||
renderableBuilder.add(bold(text("Deprecated:")));
|
||||
renderableBuilder.add(text(" " + reason));
|
||||
} else {
|
||||
renderableBuilder.add(bold(text("Deprecated!")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void descriptionRenderable(Builder<Renderable> renderableBuilder, Renderable description) {
|
||||
renderableBuilder.add(paragraph(description));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2019 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
|
||||
@@ -119,6 +119,11 @@ public abstract class AbstractPropsEditorTest {
|
||||
editor.assertCompletionDetails(expectLabel, expectDetail, expectDocumenation);
|
||||
}
|
||||
|
||||
public void assertCompletionDetailsWithDeprecation(String editorText, String expectLabel, String expectDetail, String expectDocumenation, Boolean deprecated) throws Exception {
|
||||
Editor editor = newEditor(editorText);
|
||||
editor.assertCompletionDetailsWithDeprecation(expectLabel, expectDetail, expectDocumenation, deprecated);
|
||||
}
|
||||
|
||||
public boolean isEmptyMetadata() {
|
||||
return md.isEmpty();
|
||||
}
|
||||
@@ -247,19 +252,6 @@ public abstract class AbstractPropsEditorTest {
|
||||
}
|
||||
}
|
||||
|
||||
public void assertStyledCompletions(String editorText, StyledStringMatcher... expectStyles) throws Exception {
|
||||
Editor editor = newEditor(editorText);
|
||||
List<CompletionItem> completions = editor.getCompletions();
|
||||
assertEquals("Wrong number of elements", expectStyles.length, completions.size());
|
||||
for (int i = 0; i < expectStyles.length; i++) {
|
||||
CompletionItem completion = completions.get(i);
|
||||
throw new UnsupportedOperationException("Suport for styled labels not implemented");
|
||||
// StyledString actualLabel = getStyledDisplayString(completion);
|
||||
// expectStyles[i].match(actualLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void deprecate(String key, String replacedBy, String reason) {
|
||||
md.deprecate(key, replacedBy, reason);
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016 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.editor.harness;
|
||||
|
||||
//import org.eclipse.jface.viewers.StyledString;
|
||||
//import org.eclipse.swt.custom.StyleRange;
|
||||
|
||||
public abstract class StyledStringMatcher {
|
||||
|
||||
// public abstract void match(StyledString styledString) throws Exception;
|
||||
|
||||
/**
|
||||
* Creates a matcher that matches a given {@link StyledString} if a given String
|
||||
* equals the concatenation of all the text in the {@link StyledString} formatted
|
||||
* in 'plain' font (currently 'plain' just means that it is not using 'strikeout'
|
||||
* as that is the only other style we currently care about).
|
||||
*/
|
||||
public static StyledStringMatcher plainFont(final String string) {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
// return new StyledStringMatcher() {
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "plain("+string+")";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void match(StyledString styledString) throws Exception {
|
||||
// StringBuilder extractedText = new StringBuilder();
|
||||
// String string = styledString.getString();
|
||||
// for (StyleRange styleRange : styledString.getStyleRanges()) {
|
||||
// if (!styleRange.strikeout) {
|
||||
// extractedText.append(string.substring(styleRange.start, styleRange.start + styleRange.length));
|
||||
// }
|
||||
// }
|
||||
// assertEquals(string, extractedText.toString());
|
||||
// }
|
||||
// };
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a matcher that matches a given {@link StyledString} if a given String
|
||||
* equals the concatenation of all the text in the {@link StyledString} formatted
|
||||
* in 'strikeout' font.
|
||||
*/
|
||||
public static StyledStringMatcher strikeout(final String expectedString) {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
// return new StyledStringMatcher() {
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "strikeout("+expectedString+")";
|
||||
// }
|
||||
// @Override
|
||||
// public void match(StyledString styledString) throws Exception {
|
||||
// StringBuilder extractedText = new StringBuilder();
|
||||
// String unstyledString = styledString.getString();
|
||||
// for (StyleRange styleRange : styledString.getStyleRanges()) {
|
||||
// if (styleRange.strikeout) {
|
||||
// extractedText.append(unstyledString.substring(styleRange.start, styleRange.start + styleRange.length));
|
||||
// }
|
||||
// }
|
||||
// assertEquals(expectedString, extractedText.toString());
|
||||
// }
|
||||
// };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2019 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
|
||||
@@ -10,7 +10,6 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.ide.vscode.boot.properties.reconcile.ApplicationPropertiesProblemType.PROP_DUPLICATE_KEY;
|
||||
@@ -37,7 +36,6 @@ import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
|
||||
import org.springframework.ide.vscode.boot.bootiful.PropertyEditorTestConf;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.AbstractPropsEditorTest;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.AdHocPropertyHarness;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.StyledStringMatcher;
|
||||
import org.springframework.ide.vscode.boot.metadata.CachingValueProvider;
|
||||
import org.springframework.ide.vscode.boot.metadata.PropertiesLoader;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
@@ -957,19 +955,24 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedPropertyCompletion() throws Exception {
|
||||
@Test public void testDeprecatedPropertyCompletion() throws Exception {
|
||||
data("error.path", "java.lang.String", null, "Path of the error controller.");
|
||||
data("server.error.path", "java.lang.String", null, "Path of the error controller.");
|
||||
deprecate("error.path", "server.error.path", "This is old.");
|
||||
assertCompletionsDisplayString("error.pa<*>",
|
||||
true,
|
||||
"server.error.path : String", // should be first because it is not deprecated, even though it is not as good a pattern match
|
||||
"error.path : String"
|
||||
);
|
||||
//TODO: could we check that 'deprecated' completions are formatted with 'strikethrough font?
|
||||
assertStyledCompletions("error.pa<*>",
|
||||
StyledStringMatcher.plainFont("server.error.path : String"),
|
||||
StyledStringMatcher.strikeout("error.path")
|
||||
);
|
||||
assertCompletionDetailsWithDeprecation("error.pa<*>", "server.error.path", "String", null, null);
|
||||
assertCompletionDetailsWithDeprecation("error.pa<*>", "error.path", "String",
|
||||
"~~error.path~~ \u2192 server.error.path \n" +
|
||||
"\n" +
|
||||
"Path of the error controller.\n" +
|
||||
"\n" +
|
||||
"**Deprecated:** This is old",
|
||||
Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Test public void testDeprecatedPropertyHoverInfo() throws Exception {
|
||||
@@ -980,15 +983,15 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
);
|
||||
|
||||
deprecate("error.path", "server.error.path", null);
|
||||
editor.assertHoverText("path", "~~error.path~~ -> server.error.path");
|
||||
editor.assertHoverText("path", "~~error.path~~ \u2192 server.error.path");
|
||||
editor.assertHoverText("path", "**Deprecated!**");
|
||||
|
||||
deprecate("error.path", "server.error.path", "This is old.");
|
||||
editor.assertHoverText("path", "~~error.path~~ -> server.error.path");
|
||||
editor.assertHoverText("path", "**Deprecated: **This is old");
|
||||
editor.assertHoverText("path", "~~error.path~~ \u2192 server.error.path");
|
||||
editor.assertHoverText("path", "**Deprecated:** This is old");
|
||||
|
||||
deprecate("error.path", null, "This is old.");
|
||||
editor.assertHoverText("path", "**Deprecated: **This is old");
|
||||
editor.assertHoverText("path", "**Deprecated:** This is old");
|
||||
|
||||
deprecate("error.path", null, null);
|
||||
editor.assertHoverText("path", "**Deprecated!**");
|
||||
@@ -1029,16 +1032,14 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedBeanPropertyCompletions() throws Exception {
|
||||
@Test public void testDeprecatedBeanPropertyCompletions() throws Exception {
|
||||
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
|
||||
useProject(p);
|
||||
data("foo", "demo.Deprecater", null, "A Bean with deprecated properties");
|
||||
|
||||
assertStyledCompletions("foo.nam<*>",
|
||||
StyledStringMatcher.plainFont("new-name : String"),
|
||||
StyledStringMatcher.strikeout("name"),
|
||||
StyledStringMatcher.strikeout("alt-name")
|
||||
);
|
||||
assertCompletionDetailsWithDeprecation("foo.nam<*>", "new-name", "String", null, null);
|
||||
assertCompletionDetailsWithDeprecation("foo.nam<*>", "name", "String", null, Boolean.TRUE);
|
||||
assertCompletionDetailsWithDeprecation("foo.nam<*>", "alt-name", "String", null, Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Test public void testCharsetCompletions() throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2019 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
|
||||
@@ -32,7 +32,6 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
|
||||
import org.springframework.ide.vscode.boot.bootiful.PropertyEditorTestConf;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.AbstractPropsEditorTest;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.StyledStringMatcher;
|
||||
import org.springframework.ide.vscode.boot.metadata.CachingValueProvider;
|
||||
import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
@@ -2669,23 +2668,27 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedPropertyCompletion() throws Exception {
|
||||
@Test public void testDeprecatedPropertyCompletion() throws Exception {
|
||||
data("error.path", "java.lang.String", null, "Path of the error controller.");
|
||||
data("server.error.path", "java.lang.String", null, "Path of the error controller.");
|
||||
deprecate("error.path", "server.error.path", "This is old.");
|
||||
assertCompletionsDisplayString(
|
||||
"errorpa<*>"
|
||||
, // =>
|
||||
"errorpa<*>",
|
||||
true, // =>
|
||||
"server.error.path : String", // should be first because it is not deprecated, even though it is not as good a pattern match
|
||||
"error.path : String"
|
||||
);
|
||||
assertStyledCompletions("error.pa<*>",
|
||||
StyledStringMatcher.plainFont("server.error.path : String"),
|
||||
StyledStringMatcher.strikeout("error.path")
|
||||
);
|
||||
assertCompletionDetailsWithDeprecation("error.pa<*>", "server.error.path", "String", null, null);
|
||||
assertCompletionDetailsWithDeprecation("error.pa<*>", "error.path", "String",
|
||||
"~~error.path~~ \u2192 server.error.path \n" +
|
||||
"\n" +
|
||||
"Path of the error controller.\n" +
|
||||
"\n" +
|
||||
"**Deprecated:** This is old",
|
||||
Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedPropertyHoverInfo() throws Exception {
|
||||
@Test public void testDeprecatedPropertyHoverInfo() throws Exception {
|
||||
data("error.path", "java.lang.String", null, "Path of the error controller.");
|
||||
Editor editor = newEditor(
|
||||
"# a comment\n"+
|
||||
@@ -2694,21 +2697,21 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
);
|
||||
|
||||
deprecate("error.path", "server.error.path", null);
|
||||
editor.assertHoverContains("path", "<s>error.path</s> -> server.error.path");
|
||||
editor.assertHoverContains("path", "<b>Deprecated!</b>");
|
||||
editor.assertHoverContains("path", "~~error.path~~ \u2192 server.error.path");
|
||||
editor.assertHoverContains("path", "**Deprecated!**");
|
||||
|
||||
deprecate("error.path", "server.error.path", "This is old.");
|
||||
editor.assertHoverContains("path", "<s>error.path</s> -> server.error.path");
|
||||
editor.assertHoverContains("path", "<b>Deprecated: </b>This is old");
|
||||
editor.assertHoverContains("path", "~~error.path~~ \u2192 server.error.path");
|
||||
editor.assertHoverContains("path", "**Deprecated:** This is old");
|
||||
|
||||
deprecate("error.path", null, "This is old.");
|
||||
editor.assertHoverContains("path", "<b>Deprecated: </b>This is old");
|
||||
editor.assertHoverContains("path", "**Deprecated:** This is old");
|
||||
|
||||
deprecate("error.path", null, null);
|
||||
editor.assertHoverContains("path", "<b>Deprecated!</b>");
|
||||
editor.assertHoverContains("path", "**Deprecated!**");
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedBeanPropertyHoverInfo() throws Exception {
|
||||
@Test public void testDeprecatedBeanPropertyHoverInfo() throws Exception {
|
||||
IJavaProject jp = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
|
||||
useProject(jp);
|
||||
data("foo", "demo.Deprecater", null, "A bean with deprecated property.");
|
||||
@@ -2718,7 +2721,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
" name: foo\n"
|
||||
);
|
||||
|
||||
editor.assertHoverContains("name", "<b>Deprecated!</b>");
|
||||
editor.assertHoverContains("name", "**Deprecated!**");
|
||||
}
|
||||
|
||||
@Test public void testDeprecatedBeanPropertyReconcile() throws Exception {
|
||||
@@ -2754,19 +2757,14 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedBeanPropertyCompletions() throws Exception {
|
||||
@Test public void testDeprecatedBeanPropertyCompletions() throws Exception {
|
||||
IJavaProject jp = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
|
||||
useProject(jp);
|
||||
data("foo", "demo.Deprecater", null, "A Bean with deprecated properties");
|
||||
|
||||
assertStyledCompletions(
|
||||
"foo:\n" +
|
||||
" nam<*>"
|
||||
, // =>
|
||||
StyledStringMatcher.plainFont("new-name : String"),
|
||||
StyledStringMatcher.strikeout("name"),
|
||||
StyledStringMatcher.strikeout("alt-name")
|
||||
);
|
||||
assertCompletionDetailsWithDeprecation("foo:\n nam<*>", "new-name", "String", null, null);
|
||||
assertCompletionDetailsWithDeprecation("foo:\n nam<*>", "name", "String", null, Boolean.TRUE);
|
||||
assertCompletionDetailsWithDeprecation("foo:\n nam<*>", "alt-name", "String", null, Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Ignore @Test public void testDeprecatedPropertyQuickfixSimple() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user