removed the @Bean marker for class-based functions

This commit is contained in:
Martin Lippert
2018-01-02 15:04:59 +01:00
parent 1263093c58
commit 1fb2c3a04b
2 changed files with 10 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ public class BeansSymbolProvider implements SymbolProvider {
for (Tuple2<String, DocumentRegion> nameAndRegion : getBeanNames(node, doc)) {
try {
symbols.add(new SymbolInformation(
beanLabel(isFunction, nameAndRegion.getT1(), beanType),
beanLabel(isFunction, nameAndRegion.getT1(), beanType, "@Bean"),
SymbolKind.Interface,
new Location(doc.getUri(), doc.toRange(nameAndRegion.getT2()))
));
@@ -78,7 +78,7 @@ public class BeansSymbolProvider implements SymbolProvider {
if (functionBean != null) {
try {
SymbolInformation symbol = new SymbolInformation(
beanLabel(true, functionBean.getT1(), functionBean.getT2()),
beanLabel(true, functionBean.getT1(), functionBean.getT2(), null),
SymbolKind.Interface,
new Location(doc.getUri(), doc.toRange(functionBean.getT3())));
return ImmutableList.of(symbol);
@@ -161,7 +161,7 @@ public class BeansSymbolProvider implements SymbolProvider {
}
}
protected String beanLabel(boolean isFunctionBean, String beanName, String beanType) {
protected String beanLabel(boolean isFunctionBean, String beanName, String beanType, String markerString) {
StringBuilder symbolLabel = new StringBuilder();
symbolLabel.append('@');
symbolLabel.append(isFunctionBean ? '>' : '+');
@@ -169,7 +169,10 @@ public class BeansSymbolProvider implements SymbolProvider {
symbolLabel.append('\'');
symbolLabel.append(beanName);
symbolLabel.append('\'');
symbolLabel.append(" (@Bean) ");
markerString = markerString != null && markerString.length() > 0 ? " (" + markerString + ") " : " ";
symbolLabel.append(markerString);
symbolLabel.append(beanType);
return symbolLabel.toString();
}

View File

@@ -65,7 +65,7 @@ public class SpringIndexerFunctionBeansTest {
String uriPrefix = "file://" + directory.getAbsolutePath();
indexer.assertDocumentSymbols(uriPrefix + "/src/main/java/org/test/ScannedFunctionClass.java",
symbol("ScannedFunctionClass", "@> 'scannedFunctionClass' (@Bean) Function<String,String>")
symbol("ScannedFunctionClass", "@> 'scannedFunctionClass' Function<String,String>")
);
}
@@ -77,7 +77,7 @@ public class SpringIndexerFunctionBeansTest {
String uriPrefix = "file://" + directory.getAbsolutePath();
indexer.assertDocumentSymbols(uriPrefix + "/src/main/java/org/test/FunctionFromSpecializedClass.java",
symbol("FunctionFromSpecializedClass", "@> 'functionFromSpecializedClass' (@Bean) Function<String,String>")
symbol("FunctionFromSpecializedClass", "@> 'functionFromSpecializedClass' Function<String,String>")
);
}
@@ -89,7 +89,7 @@ public class SpringIndexerFunctionBeansTest {
String uriPrefix = "file://" + directory.getAbsolutePath();
indexer.assertDocumentSymbols(uriPrefix + "/src/main/java/org/test/FunctionFromSpecializedInterface.java",
symbol("FunctionFromSpecializedInterface", "@> 'functionFromSpecializedInterface' (@Bean) Function<String,String>")
symbol("FunctionFromSpecializedInterface", "@> 'functionFromSpecializedInterface' Function<String,String>")
);
}