use of org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation in project sts4 by spring-projects.
the class SpringIndexer method extractSymbolInformation.
private void extractSymbolInformation(Annotation node, String docURI, AtomicReference<TextDocument> docRef, String content) throws Exception {
ITypeBinding typeBinding = node.resolveTypeBinding();
if (typeBinding != null) {
Collection<SymbolProvider> providers = symbolProviders.get(typeBinding);
Collection<ITypeBinding> metaAnnotations = AnnotationHierarchies.getMetaAnnotations(typeBinding, symbolProviders::containsKey);
if (!providers.isEmpty()) {
TextDocument doc = getTempTextDocument(docURI, docRef, content);
for (SymbolProvider provider : providers) {
Collection<EnhancedSymbolInformation> sbls = provider.getSymbols(node, typeBinding, metaAnnotations, doc);
if (sbls != null) {
sbls.forEach(enhancedSymbol -> {
symbols.add(enhancedSymbol.getSymbol());
symbolsByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolInformation>()).add(enhancedSymbol.getSymbol());
if (enhancedSymbol.getAdditionalInformation() != null) {
addonInformation.addAll(Arrays.asList(enhancedSymbol.getAdditionalInformation()));
addonInformationByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolAddOnInformation>()).addAll(Arrays.asList(enhancedSymbol.getAdditionalInformation()));
}
});
}
}
} else {
SymbolInformation symbol = provideDefaultSymbol(node, docURI, docRef, content);
if (symbol != null) {
symbols.add(symbol);
symbolsByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolInformation>()).add(symbol);
}
}
}
}
use of org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation in project sts4 by spring-projects.
the class SpringIndexer method extractSymbolInformation.
private void extractSymbolInformation(TypeDeclaration typeDeclaration, String docURI, AtomicReference<TextDocument> docRef, String content) throws Exception {
Collection<SymbolProvider> providers = symbolProviders.getAll();
if (!providers.isEmpty()) {
TextDocument doc = getTempTextDocument(docURI, docRef, content);
for (SymbolProvider provider : providers) {
Collection<EnhancedSymbolInformation> sbls = provider.getSymbols(typeDeclaration, doc);
if (sbls != null) {
sbls.forEach(enhancedSymbol -> {
symbols.add(enhancedSymbol.getSymbol());
symbolsByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolInformation>()).add(enhancedSymbol.getSymbol());
if (enhancedSymbol.getAdditionalInformation() != null) {
addonInformation.addAll(Arrays.asList(enhancedSymbol.getAdditionalInformation()));
addonInformationByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolAddOnInformation>()).addAll(Arrays.asList(enhancedSymbol.getAdditionalInformation()));
}
});
}
}
}
}
use of org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation in project sts4 by spring-projects.
the class SpringIndexer method extractSymbolInformation.
private void extractSymbolInformation(MethodDeclaration methodDeclaration, String docURI, AtomicReference<TextDocument> docRef, String content) throws Exception {
Collection<SymbolProvider> providers = symbolProviders.getAll();
if (!providers.isEmpty()) {
TextDocument doc = getTempTextDocument(docURI, docRef, content);
for (SymbolProvider provider : providers) {
Collection<EnhancedSymbolInformation> sbls = provider.getSymbols(methodDeclaration, doc);
if (sbls != null) {
sbls.forEach(enhancedSymbol -> {
symbols.add(enhancedSymbol.getSymbol());
symbolsByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolInformation>()).add(enhancedSymbol.getSymbol());
if (enhancedSymbol.getAdditionalInformation() != null) {
addonInformation.addAll(Arrays.asList(enhancedSymbol.getAdditionalInformation()));
addonInformationByDoc.computeIfAbsent(docURI, s -> new ArrayList<SymbolAddOnInformation>()).addAll(Arrays.asList(enhancedSymbol.getAdditionalInformation()));
}
});
}
}
}
}
use of org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation in project sts4 by spring-projects.
the class RouteUtils method createRouteSymbol.
public static EnhancedSymbolInformation createRouteSymbol(Location location, String path, String[] httpMethods, String[] contentTypes, String[] acceptTypes, SymbolAddOnInformation[] enhancedInformation) {
if (path != null && path.length() > 0) {
String label = "@" + (path.startsWith("/") ? path : ("/" + path));
label += (httpMethods == null || httpMethods.length == 0 ? "" : " -- " + WebfluxUtils.getStringRep(httpMethods, string -> string));
String acceptType = WebfluxUtils.getStringRep(acceptTypes, WebfluxUtils::getMediaType);
label += acceptType != null ? " - Accept: " + acceptType : "";
String contentType = WebfluxUtils.getStringRep(contentTypes, WebfluxUtils::getMediaType);
label += contentType != null ? " - Content-Type: " + contentType : "";
return new EnhancedSymbolInformation(new SymbolInformation(label, SymbolKind.Interface, location), enhancedInformation);
} else {
return null;
}
}
use of org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation in project sts4 by spring-projects.
the class ComponentSymbolProvider method createSymbol.
protected EnhancedSymbolInformation createSymbol(Annotation node, ITypeBinding annotationType, Collection<ITypeBinding> metaAnnotations, TextDocument doc) throws BadLocationException {
String annotationTypeName = annotationType.getName();
Collection<String> metaAnnotationNames = metaAnnotations.stream().map(ITypeBinding::getName).collect(Collectors.toList());
String beanName = getBeanName(node);
String beanType = getBeanType(node);
SymbolInformation symbol = new SymbolInformation(beanLabel("+", annotationTypeName, metaAnnotationNames, beanName, beanType), SymbolKind.Interface, new Location(doc.getUri(), doc.toRange(node.getStartPosition(), node.getLength())));
return new EnhancedSymbolInformation(symbol, null);
}
Aggregations