Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -515,16 +515,14 @@ public static HighlightInfo.Builder checkMethodCall(
hlBuilder = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
.descriptionAndTooltip(errorMessage)
.range(fixRange);
if (hlBuilder != null) {
registerMethodCallIntentions(hlBuilder, methodCall, list, resolveHelper);
registerMethodReturnFixAction(hlBuilder, (MethodCandidateInfo)resolveResult, methodCall);
registerTargetTypeFixesBasedOnApplicabilityInference(
methodCall,
(MethodCandidateInfo)resolveResult,
(PsiMethod)resolved,
hlBuilder
);
}
registerMethodCallIntentions(hlBuilder, methodCall, list, resolveHelper);
registerMethodReturnFixAction(hlBuilder, (MethodCandidateInfo)resolveResult, methodCall);
registerTargetTypeFixesBasedOnApplicabilityInference(
methodCall,
(MethodCandidateInfo)resolveResult,
(PsiMethod)resolved,
hlBuilder
);
}
}
}
Expand Down Expand Up @@ -559,18 +557,16 @@ else if (candidateInfo != null && !candidateInfo.isApplicable()) {
toolTip = description;
}
PsiElement element = elementToHighlight.get();
int navigationShift =
element instanceof PsiExpressionList ? +1 : 0; // argument list starts with paren which there is no need to highlight
// argument list starts with paren which there is no need to highlight
int navigationShift = element instanceof PsiExpressionList ? +1 : 0;
hlBuilder = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
.range(element)
.description(description)
.escapedToolTip(toolTip)
.navigationShift(navigationShift);
if (hlBuilder != null) {
registerMethodCallIntentions(hlBuilder, methodCall, list, resolveHelper);
registerMethodReturnFixAction(hlBuilder, candidateInfo, methodCall);
registerTargetTypeFixesBasedOnApplicabilityInference(methodCall, candidateInfo, resolvedMethod, hlBuilder);
}
registerMethodCallIntentions(hlBuilder, methodCall, list, resolveHelper);
registerMethodReturnFixAction(hlBuilder, candidateInfo, methodCall);
registerTargetTypeFixesBasedOnApplicabilityInference(methodCall, candidateInfo, resolvedMethod, hlBuilder);
}
else {
PsiReferenceExpression methodExpression = methodCall.getMethodExpression();
Expand Down Expand Up @@ -2305,7 +2301,7 @@ private static void registerChangeMethodSignatureFromUsageIntentions(
@Nonnull JavaResolveResult[] candidates,
@Nonnull PsiExpressionList list,
@Nullable HighlightInfo.Builder highlightInfo,
TextRange fixRange
@Nullable TextRange fixRange
) {
if (candidates.length == 0) {
return;
Expand All @@ -2318,19 +2314,19 @@ private static void registerChangeMethodSignatureFromUsageIntentions(

private static void registerChangeMethodSignatureFromUsageIntention(
@Nonnull PsiExpression[] expressions,
@Nullable HighlightInfo.Builder highlightInfo,
TextRange fixRange,
@Nullable HighlightInfo.Builder hlBuilder,
@Nullable TextRange fixRange,
@Nonnull JavaResolveResult candidate,
@Nonnull PsiElement context
) {
if (highlightInfo == null || !candidate.isStaticsScopeCorrect()) {
if (hlBuilder == null || !candidate.isStaticsScopeCorrect()) {
return;
}
PsiMethod method = (PsiMethod)candidate.getElement();
PsiSubstitutor substitutor = candidate.getSubstitutor();
if (method != null && context.getManager().isInProject(method)) {
QuickFixFactory factory = QuickFixFactory.getInstance();
highlightInfo.registerFix(
hlBuilder.registerFix(
factory.createChangeMethodSignatureFromUsageFix(
method,
expressions,
Expand All @@ -2339,9 +2335,12 @@ private static void registerChangeMethodSignatureFromUsageIntention(
false,
2
),
fixRange
null,
null,
fixRange,
null
);
highlightInfo.registerFix(
hlBuilder.registerFix(
factory.createChangeMethodSignatureFromUsageReverseOrderFix(
method,
expressions,
Expand All @@ -2350,7 +2349,10 @@ private static void registerChangeMethodSignatureFromUsageIntention(
false,
2
),
fixRange
null,
null,
fixRange,
null
);
}
}
Expand Down
Loading