mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
InlineStreamMapAction: support parenthesized chain
This commit is contained in:
+4
-7
@@ -84,13 +84,10 @@ public class InlineStreamMapAction extends PsiElementBaseIntentionAction {
|
||||
|
||||
@Nullable
|
||||
private static PsiMethodCallExpression getNextExpressionToMerge(PsiMethodCallExpression methodCallExpression) {
|
||||
PsiElement parent = methodCallExpression.getParent();
|
||||
if(!(parent instanceof PsiReferenceExpression)) return null;
|
||||
PsiElement gParent = parent.getParent();
|
||||
if(!(gParent instanceof PsiMethodCallExpression)) return null;
|
||||
String nextName = ((PsiReferenceExpression)parent).getReferenceName();
|
||||
PsiMethodCallExpression nextCall = (PsiMethodCallExpression)gParent;
|
||||
if(nextName == null || !NEXT_METHODS.contains(nextName) || translateName(methodCallExpression, nextCall) == null) return null;
|
||||
PsiMethodCallExpression nextCall = ExpressionUtils.getCallForQualifier(methodCallExpression);
|
||||
if (nextCall == null) return null;
|
||||
String nextName = nextCall.getMethodExpression().getReferenceName();
|
||||
if (nextName == null || !NEXT_METHODS.contains(nextName) || translateName(methodCallExpression, nextCall) == null) return null;
|
||||
PsiExpressionList argumentList = (nextCall).getArgumentList();
|
||||
PsiExpression[] expressions = argumentList.getExpressions();
|
||||
if(expressions.length == 0) {
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public static void test(List<CharSequence> list) {
|
||||
list.stream().map(cs -> cs.subSequence(1, 5)).ma<caret>p(CharSequence::length).forEach(System.out::println);
|
||||
((list.stream().map(cs -> cs.subSequence(1, 5))).ma<caret>p(CharSequence::length)).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user