use of org.eclipse.lsp4j.CallHierarchyItem in project eclipse.jdt.ls by eclipse.
the class CallHierarchyHandlerTest method testSelectionRange.
@Test
public void testSelectionRange() throws Exception {
// Line from `org.sample.Foo`
// public void <|>someMethod() {}
String uri = getUriFromSrcProject("org.sample.Foo");
List<CallHierarchyItem> items = prepareCallHierarchy(uri, 8, 13);
assertNotNull(items);
assertEquals(1, items.size());
assertItem(items.get(0), "someMethod()" + JavaElementLabels.DECL_STRING + "void", Method, "org.sample.Foo", false, 8);
List<CallHierarchyIncomingCall> calls = getIncomingCalls(items.get(0));
assertNotNull(calls);
assertEquals(4, calls.size());
assertItem(calls.get(2).getFrom(), "main(String[]) : void", Method, "org.sample.Call", false, 7);
assertItem(calls.get(3).getFrom(), "main(String[]) : void", Method, "org.sample.Call", false, 10);
Range selectionRange = calls.get(2).getFrom().getSelectionRange();
assertEquals(new Range(new Position(7, 18), new Position(7, 30)), selectionRange);
selectionRange = calls.get(3).getFrom().getSelectionRange();
assertEquals(new Range(new Position(10, 18), new Position(10, 30)), selectionRange);
}
Aggregations