"Move lambda argument into parentheses" intention - slightly wider range
This commit is contained in:
@@ -44,14 +44,11 @@ public class JetFunctionLiteralExpression extends JetExpressionImpl {
|
||||
return getFunctionLiteral().getValueParameters();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetBlockExpression getBodyExpression() {
|
||||
return getFunctionLiteral().getBodyExpression();
|
||||
}
|
||||
|
||||
public boolean hasBlockBody() {
|
||||
return getFunctionLiteral().hasBlockBody();
|
||||
}
|
||||
|
||||
public boolean hasDeclaredReturnType() {
|
||||
return getFunctionLiteral().getTypeReference() != null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,9 +23,9 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
|
||||
|
||||
public class MoveLambdaInsideParenthesesIntention : JetSelfTargetingIntention<JetFunctionLiteralArgument>(javaClass(), "Move lambda argument into parentheses") {
|
||||
override fun isApplicableTo(element: JetFunctionLiteralArgument, caretOffset: Int): Boolean {
|
||||
val lBrace = element.getFunctionLiteral().getLeftCurlyBrace()
|
||||
val rBrace = element.getFunctionLiteral().getRightCurlyBrace() ?: return false
|
||||
return caretOffset < lBrace.getTextRange().getEndOffset() || rBrace.getTextRange().containsOffset(caretOffset)
|
||||
val body = element.getFunctionLiteral().getBodyExpression() ?: return true
|
||||
val bodyRange = body.getTextRange()
|
||||
return caretOffset <= bodyRange.getStartOffset() || caretOffset >= bodyRange.getEndOffset()
|
||||
}
|
||||
|
||||
override fun applyTo(element: JetFunctionLiteralArgument, editor: Editor) {
|
||||
|
||||
Reference in New Issue
Block a user