mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't offer the callee of a call as a smart introduce variant (PY-1026)
This commit is contained in:
@@ -140,7 +140,7 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
|
||||
if (elementAtCaret instanceof PyStatement) {
|
||||
break;
|
||||
}
|
||||
if (elementAtCaret instanceof PyExpression) {
|
||||
if (elementAtCaret instanceof PyExpression && isValidIntroduceVariant(elementAtCaret)) {
|
||||
expressions.add((PyExpression)elementAtCaret);
|
||||
}
|
||||
elementAtCaret = elementAtCaret.getParent();
|
||||
@@ -165,6 +165,14 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isValidIntroduceVariant(PsiElement element) {
|
||||
final PyCallExpression call = PsiTreeUtil.getParentOfType(element, PyCallExpression.class);
|
||||
if (call != null && PsiTreeUtil.isAncestor(call.getCallee(), element, false)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void performActionOnElement(Editor editor,
|
||||
PsiElement element,
|
||||
String name,
|
||||
|
||||
Reference in New Issue
Block a user