mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
changes in function signature are out-of-code-block changes (PY-821)
This commit is contained in:
@@ -88,7 +88,8 @@ public class PythonPsiManager extends AbstractProjectComponent implements PsiTre
|
||||
}
|
||||
PsiElement pparent = element.getParent();
|
||||
if (pparent instanceof PyFunction) {
|
||||
return true;
|
||||
final PyFunction pyFunction = (PyFunction)pparent;
|
||||
return !(element == pyFunction.getParameterList() || element == pyFunction.getNameIdentifier());
|
||||
}
|
||||
element = pparent;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiNameIdentifierOwner;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.StubBasedPsiElement;
|
||||
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
|
||||
@@ -13,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*
|
||||
* @author yole
|
||||
*/
|
||||
public interface PyFunction extends PsiNamedElement, PyStatement, NameDefiner, PyDocStringOwner, StubBasedPsiElement<PyFunctionStub>,
|
||||
public interface PyFunction extends PsiNamedElement, PsiNameIdentifierOwner, PyStatement, NameDefiner, PyDocStringOwner, StubBasedPsiElement<PyFunctionStub>,
|
||||
ScopeOwner {
|
||||
PyFunction[] EMPTY_ARRAY = new PyFunction[0];
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ public class PyFunctionImpl extends PyPresentableElementImpl<PyFunctionStub> imp
|
||||
return node != null ? node.getText() : null;
|
||||
}
|
||||
|
||||
public PsiElement getNameIdentifier() {
|
||||
final ASTNode nameNode = getNameNode();
|
||||
return nameNode != null ? nameNode.getPsi() : null;
|
||||
}
|
||||
|
||||
public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
|
||||
final ASTNode nameElement = PyElementGenerator.getInstance(getProject()).createNameIdentifier(name);
|
||||
getNode().replaceChild(getNameNode(), nameElement);
|
||||
|
||||
Reference in New Issue
Block a user