implements PLN-0137 (7/7) call-hierarchy
Call hierarchy walks CallExpr nodes for functions and methods. It does not use the references index. A cursor that is not on a callable is empty, and type hierarchy stays unadvertised. Housekeep DSC-0066 with LSN-0074.
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record FrontendCallHierarchyItem(
|
||||
String name,
|
||||
boolean method,
|
||||
int startOffset,
|
||||
int endOffset) {
|
||||
|
||||
public FrontendCallHierarchyItem {
|
||||
name = Objects.requireNonNull(name, "name").trim();
|
||||
if (name.isEmpty()) {
|
||||
throw new IllegalArgumentException("name must not be blank");
|
||||
}
|
||||
if (startOffset < 0 || endOffset < startOffset) {
|
||||
throw new IllegalArgumentException("call hierarchy range is invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record FrontendCallSite(
|
||||
FrontendCallHierarchyItem item,
|
||||
int startOffset,
|
||||
int endOffset) {
|
||||
|
||||
public FrontendCallSite {
|
||||
item = Objects.requireNonNull(item, "item");
|
||||
if (startOffset < 0 || endOffset < startOffset) {
|
||||
throw new IllegalArgumentException("call site range is invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -190,6 +190,31 @@ public interface FrontendLanguageService {
|
||||
return selectionRanges(request, offsets);
|
||||
}
|
||||
|
||||
default boolean callHierarchySupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
default java.util.List<FrontendCallHierarchyItem> prepareCallHierarchy(
|
||||
final FrontendDocumentRequest request,
|
||||
final FrontendEditorialContext editorialContext,
|
||||
final int offset) {
|
||||
return java.util.List.of();
|
||||
}
|
||||
|
||||
default java.util.List<FrontendCallSite> incomingCalls(
|
||||
final FrontendDocumentRequest request,
|
||||
final FrontendEditorialContext editorialContext,
|
||||
final FrontendCallHierarchyItem target) {
|
||||
return java.util.List.of();
|
||||
}
|
||||
|
||||
default java.util.List<FrontendCallSite> outgoingCalls(
|
||||
final FrontendDocumentRequest request,
|
||||
final FrontendEditorialContext editorialContext,
|
||||
final FrontendCallHierarchyItem target) {
|
||||
return java.util.List.of();
|
||||
}
|
||||
|
||||
default boolean formattingSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user