use of org.springframework.ide.vscode.boot.java.handlers.SymbolProvider 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.SymbolProvider 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.SymbolProvider 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.SymbolProvider in project sts4 by spring-projects.
the class BootJavaLanguageServerComponents method createAnnotationIndexer.
protected SpringIndexer createAnnotationIndexer(SimpleLanguageServer server, BootLanguageServerParams params) {
AnnotationHierarchyAwareLookup<SymbolProvider> providers = new AnnotationHierarchyAwareLookup<>();
providers.put(Annotations.SPRING_REQUEST_MAPPING, new RequestMappingSymbolProvider());
providers.put(Annotations.SPRING_GET_MAPPING, new RequestMappingSymbolProvider());
providers.put(Annotations.SPRING_POST_MAPPING, new RequestMappingSymbolProvider());
providers.put(Annotations.SPRING_PUT_MAPPING, new RequestMappingSymbolProvider());
providers.put(Annotations.SPRING_DELETE_MAPPING, new RequestMappingSymbolProvider());
providers.put(Annotations.SPRING_PATCH_MAPPING, new RequestMappingSymbolProvider());
providers.put(Annotations.BEAN, new BeansSymbolProvider());
providers.put(Annotations.COMPONENT, new ComponentSymbolProvider());
providers.put(Annotations.REPOSITORY, new DataRepositorySymbolProvider());
providers.put("", new WebfluxRouterSymbolProvider());
return new SpringIndexer(server, params, providers);
}
Aggregations