PT #156686000: Fix additional cases with javadoc doc for property keys
This commit is contained in:
@@ -59,7 +59,7 @@ class BindingKeyUtils {
|
||||
}
|
||||
sb.append(')');
|
||||
sb.append(getGeneralTypeBindingKey(method.returnType()));
|
||||
return method.name().toString();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getGeneralTypeBindingKey(Type type) {
|
||||
|
||||
@@ -142,6 +142,12 @@ public class Renderables {
|
||||
// The correct implementation should probably check wether text in buffer already
|
||||
// ends with newline(s) and add more only if needed. Then it should
|
||||
// also append double newline at its end.
|
||||
|
||||
//TODO: verify that the if below solves the above "todo"
|
||||
if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) != '\n') {
|
||||
// 2 spaces and then new line would create a line break in text
|
||||
buffer.append(" ");
|
||||
}
|
||||
buffer.append("\n");
|
||||
text.renderAsMarkdown(buffer);
|
||||
buffer.append("\n");
|
||||
|
||||
@@ -124,7 +124,7 @@ public class StsValueHint {
|
||||
private static Renderable javaDocSnippet(IJavaProject project, IJavaElement je) {
|
||||
return Renderables.lazy(() -> {
|
||||
SourceLinks sourceLinks = SourceLinkFactory.createSourceLinks(null);
|
||||
return PropertyDocUtils.documentJavaValue(sourceLinks, project, je);
|
||||
return PropertyDocUtils.documentJavaElement(sourceLinks, project, je);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,13 @@ import java.util.stream.Stream;
|
||||
import javax.inject.Provider;
|
||||
|
||||
import org.springframework.ide.vscode.boot.configurationmetadata.Deprecation;
|
||||
import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory;
|
||||
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
|
||||
import org.springframework.ide.vscode.boot.metadata.ResourceHintProvider;
|
||||
import org.springframework.ide.vscode.boot.metadata.ValueProviderRegistry.ValueProviderStrategy;
|
||||
import org.springframework.ide.vscode.boot.metadata.hints.StsValueHint;
|
||||
import org.springframework.ide.vscode.boot.metadata.util.DeprecationUtil;
|
||||
import org.springframework.ide.vscode.boot.metadata.util.PropertyDocUtils;
|
||||
import org.springframework.ide.vscode.commons.java.Flags;
|
||||
import org.springframework.ide.vscode.commons.java.IField;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaElement;
|
||||
@@ -638,6 +641,8 @@ public class TypeUtil {
|
||||
|
||||
//TODO: handle type parameters.
|
||||
if (typeFromIndex != null) {
|
||||
SourceLinks sourceLinks = SourceLinkFactory.createSourceLinks(null);
|
||||
IJavaProject project = getJavaProject();
|
||||
ArrayList<TypedProperty> properties = new ArrayList<>();
|
||||
getGetterMethods(typeFromIndex).forEach(m -> {
|
||||
Deprecation deprecation = DeprecationUtil.extract(m);
|
||||
@@ -649,11 +654,11 @@ public class TypeUtil {
|
||||
}
|
||||
if (beanMode.includesHyphenated()) {
|
||||
properties.add(new TypedProperty(getterOrSetterNameToProperty(m.getElementName()), propType,
|
||||
deprecation));
|
||||
PropertyDocUtils.documentJavaElement(sourceLinks, project, m), deprecation));
|
||||
}
|
||||
if (beanMode.includesCamelCase()) {
|
||||
properties.add(new TypedProperty(getterOrSetterNameToCamelName(m.getElementName()), propType,
|
||||
deprecation));
|
||||
PropertyDocUtils.documentJavaElement(sourceLinks, project, m), deprecation));
|
||||
}
|
||||
});
|
||||
return properties;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class PropertyDocUtils {
|
||||
* @param je
|
||||
* @return
|
||||
*/
|
||||
public static Renderable documentation(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
|
||||
public static Renderable javadocContent(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
|
||||
Builder<Renderable> renderableBuilder = ImmutableList.builder();
|
||||
IJavadoc javadoc = je.getJavaDoc();
|
||||
renderableBuilder.add(Renderables.lineBreak());
|
||||
@@ -57,7 +57,7 @@ public class PropertyDocUtils {
|
||||
* @param je
|
||||
* @return
|
||||
*/
|
||||
public static Renderable documentJavaValue(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
|
||||
public static Renderable documentJavaElement(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
|
||||
Builder<Renderable> renderableBuilder = ImmutableList.builder();
|
||||
if (je instanceof IMember) {
|
||||
IMember member = (IMember) je;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2016 Pivotal, Inc.
|
||||
* Copyright (c) 2015, 2018 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
|
||||
@@ -27,6 +27,7 @@ import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
|
||||
import org.springframework.ide.vscode.boot.common.RelaxedNameConfig;
|
||||
import org.springframework.ide.vscode.boot.configurationmetadata.Deprecation;
|
||||
import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory;
|
||||
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
|
||||
import org.springframework.ide.vscode.boot.metadata.IndexNavigator;
|
||||
import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
|
||||
import org.springframework.ide.vscode.boot.metadata.hints.HintProvider;
|
||||
@@ -41,6 +42,7 @@ import org.springframework.ide.vscode.boot.metadata.types.TypedProperty;
|
||||
import org.springframework.ide.vscode.boot.metadata.util.PropertyDocUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IField;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaElement;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.java.IMember;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
|
||||
@@ -549,7 +551,9 @@ public abstract class ApplicationYamlAssistContext extends AbstractYamlAssistCon
|
||||
if (jes != null) {
|
||||
for (IJavaElement je : jes) {
|
||||
if (je instanceof IMember) {
|
||||
return PropertyDocUtils.documentation(SourceLinkFactory.createSourceLinks(null), typeUtil.getJavaProject(), je);
|
||||
SourceLinks sourceLinks = SourceLinkFactory.createSourceLinks(null);
|
||||
IJavaProject project = typeUtil.getJavaProject();
|
||||
return PropertyDocUtils.documentJavaElement(sourceLinks, project, je);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user