use of com.github._1c_syntax.bsl.languageserver.references.ReferenceIndex in project bsl-language-server by 1c-syntax.
the class CallHierarchyProvider method incomingCalls.
public List<CallHierarchyIncomingCall> incomingCalls(DocumentContext documentContext, CallHierarchyIncomingCallsParams params) {
URI uri = documentContext.getUri();
CallHierarchyItem item = params.getItem();
Position position = item.getSelectionRange().getStart();
return referenceResolver.findReference(uri, position).flatMap(Reference::getSourceDefinedSymbol).stream().map(referenceIndex::getReferencesTo).flatMap(Collection::stream).collect(groupingBy(Reference::getFrom, mapping(Reference::getSelectionRange, toCollection(ArrayList::new)))).entrySet().stream().map(entry -> new CallHierarchyIncomingCall(getCallHierarchyItem(entry.getKey()), entry.getValue())).collect(Collectors.toList());
}
use of com.github._1c_syntax.bsl.languageserver.references.ReferenceIndex in project bsl-language-server by 1c-syntax.
the class CallHierarchyProvider method outgoingCalls.
public List<CallHierarchyOutgoingCall> outgoingCalls(DocumentContext documentContext, CallHierarchyOutgoingCallsParams params) {
URI uri = documentContext.getUri();
Position position = params.getItem().getSelectionRange().getStart();
return referenceResolver.findReference(uri, position).flatMap(Reference::getSourceDefinedSymbol).stream().map(referenceIndex::getReferencesFrom).flatMap(Collection::stream).filter(Reference::isSourceDefinedSymbolReference).collect(groupingBy(reference -> reference.getSourceDefinedSymbol().orElseThrow(), mapping(Reference::getSelectionRange, toCollection(ArrayList::new)))).entrySet().stream().map(entry -> new CallHierarchyOutgoingCall(getCallHierarchyItem(entry.getKey()), entry.getValue())).collect(Collectors.toList());
}
Aggregations