Skip to content

Commit

Permalink
GH-508: Adopt the upstream lsp4j snapshot for call hierarchy
Browse files Browse the repository at this point in the history
Signed-off-by: Jinbo Wang <[email protected]>
  • Loading branch information
testforstephen authored and fbricon committed Dec 18, 2019
1 parent bdea273 commit dd830b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ private List<CallHierarchyIncomingCall> getIncomingCallItemsAt(String uri, int l
}
CallHierarchyItem symbol = toCallHierarchyItem(call.getMember());
List<Range> ranges = toCallRanges(call.getMethodCall().getCallLocations());
CallHierarchyIncomingCall incomingCall = new CallHierarchyIncomingCall();
incomingCall.setFrom(symbol);
incomingCall.setFromRanges(ranges.toArray(new Range[0]));
result.add(incomingCall);
result.add(new CallHierarchyIncomingCall(symbol, ranges));
}

return result;
Expand Down Expand Up @@ -225,10 +222,7 @@ private List<CallHierarchyOutgoingCall> getOutgoingCallItemsAt(String uri, int l
}
CallHierarchyItem symbol = toCallHierarchyItem(call.getMember());
List<Range> ranges = toCallRanges(call.getMethodCall().getCallLocations());
CallHierarchyOutgoingCall outgoingCall = new CallHierarchyOutgoingCall();
outgoingCall.setTo(symbol);
outgoingCall.setFromRanges(ranges.toArray(new Range[0]));
result.add(outgoingCall);
result.add(new CallHierarchyOutgoingCall(symbol, ranges));
}

return result;
Expand Down Expand Up @@ -271,7 +265,7 @@ private CallHierarchyItem toCallHierarchyItem(IMember member) throws JavaModelEx
IType declaringType = member.getDeclaringType();
item.setDetail(declaringType == null ? null : declaringType.getFullyQualifiedName());
if (JDTUtils.isDeprecated(member)) {
item.setTags(new SymbolTag[] { SymbolTag.Deprecated });
item.setTags(Arrays.asList(SymbolTag.Deprecated));
}

return item;
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<repository location="https://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt/1.5.3-2019-11-08_11-04-22-H22/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://github.com/testforstephen/lsp4j/raw/p2/p2/"/>
<repository location="https://download.eclipse.org/lsp4j/builds/master/"/>
<unit id="org.eclipse.lsp4j.sdk.feature.group" version="0.0.0"/>
</location>
</locations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ static CallHierarchyItem assertItem(CallHierarchyItem item, String name, SymbolK
assertEquals(detail, item.getDetail());
if (deprecated) {
assertNotNull(item.getTags());
assertTrue(Stream.of(item.getTags()).anyMatch(tag -> tag == SymbolTag.Deprecated));
assertTrue(item.getTags().stream().anyMatch(tag -> tag == SymbolTag.Deprecated));
} else {
assertTrue(item.getTags() == null || item.getTags().length == 0 || !Stream.of(item.getTags()).anyMatch(tag -> tag == SymbolTag.Deprecated));
assertTrue(item.getTags() == null || item.getTags().isEmpty() || !item.getTags().stream().anyMatch(tag -> tag == SymbolTag.Deprecated));
}

assertEquals(selectionStartLine, item.getSelectionRange().getStart().getLine());
Expand All @@ -255,14 +255,12 @@ static List<CallHierarchyItem> prepareCallHierarchy(String uri, int line, int ch
}

static List<CallHierarchyIncomingCall> getIncomingCalls(CallHierarchyItem item) {
CallHierarchyIncomingCallsParams params = new CallHierarchyIncomingCallsParams();
params.setItem(item);
CallHierarchyIncomingCallsParams params = new CallHierarchyIncomingCallsParams(item);
return new CallHierarchyHandler().callHierarchyIncomingCalls(params, new NullProgressMonitor());
}

static List<CallHierarchyOutgoingCall> getOutgoings(CallHierarchyItem item) {
CallHierarchyOutgoingCallsParams params = new CallHierarchyOutgoingCallsParams();
params.setItem(item);
CallHierarchyOutgoingCallsParams params = new CallHierarchyOutgoingCallsParams(item);
return new CallHierarchyHandler().callHierarchyOutgoingCalls(params, new NullProgressMonitor());
}

Expand Down

0 comments on commit dd830b5

Please sign in to comment.