mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
Fixed extract method in case of expression with selection that breaks AST
This commit is contained in:
@@ -97,7 +97,7 @@ public class PyExtractMethodHandler implements RefactoringActionHandler {
|
||||
|
||||
final PsiElement expression = PyRefactoringUtil.getSelectedExpression(project, file, element1, element2);
|
||||
if (expression != null) {
|
||||
final ScopeOwner owner = PsiTreeUtil.getParentOfType(expression, ScopeOwner.class);
|
||||
final ScopeOwner owner = PsiTreeUtil.getParentOfType(element1, ScopeOwner.class);
|
||||
if (owner == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
10
python/testData/codeInsight/codefragment/expression2.test
Normal file
10
python/testData/codeInsight/codefragment/expression2.test
Normal file
@@ -0,0 +1,10 @@
|
||||
r = 2
|
||||
h = 5
|
||||
|
||||
print(123 * <begin>r ** 2 * h<end>)
|
||||
|
||||
<result>
|
||||
In:
|
||||
h
|
||||
r
|
||||
Out:
|
||||
@@ -133,5 +133,9 @@ public class PyCodeFragmentTest extends LightMarkedTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExpression2() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user