diff --git a/python/pluginSrc/META-INF/plugin.xml b/python/pluginSrc/META-INF/plugin.xml
index f80bd2ad9048..d14b1e7f6070 100644
--- a/python/pluginSrc/META-INF/plugin.xml
+++ b/python/pluginSrc/META-INF/plugin.xml
@@ -4,9 +4,9 @@
Pythonid
Python
-
+
Smart editing for Python scripts
- 2.10.1
+ 2.11
com.intellij.modules.ultimate
com.intellij.modules.java
Coverage
diff --git a/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java b/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java
index eb01b9900107..74f5362a6a8b 100644
--- a/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java
+++ b/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.codeInsight.editorActions.moveUpDown;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.editorActions.moveUpDown.LineMover;
import com.intellij.codeInsight.editorActions.moveUpDown.LineRange;
import com.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover;
@@ -241,7 +241,7 @@ public class StatementMover extends LineMover {
}
}
}
-
+
private boolean isMoveToEmptyLine(Editor editor, MoveInfo info, boolean down) {
final Document document = editor.getDocument();
if (document.getLineCount() >= info.toMove2.endLine) {
@@ -467,7 +467,7 @@ public class StatementMover extends LineMover {
}
else
myStatementListToAddPass.addBefore(passStatement, myStatementListToAddPass.getStatements()[0]);
- CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(myStatementListToAddPass);
+ CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(myStatementListToAddPass);
}
if (myStatementToIncreaseIndent != null) {
if (!down && myStatementPartToRemovePass != null && myStatementToAddLinebreak == null) {
@@ -487,7 +487,7 @@ public class StatementMover extends LineMover {
final PyPassStatement passStatement =
PyElementGenerator.getInstance(editor.getProject()).createFromText(LanguageLevel.getDefault(), PyPassStatement.class, PyNames.PASS);
myStatementListToAddPassAfter.add(passStatement);
- CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(myStatementListToAddPassAfter);
+ CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(myStatementListToAddPassAfter);
}
// remove obsolete pass statement
diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertLambdaToFunctionIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertLambdaToFunctionIntention.java
index e9fe4b870465..6d5b15f58333 100644
--- a/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertLambdaToFunctionIntention.java
+++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertLambdaToFunctionIntention.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.codeInsight.intentions;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.controlflow.ControlFlow;
import com.intellij.codeInsight.controlflow.Instruction;
import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
@@ -87,7 +87,7 @@ public class PyConvertLambdaToFunctionIntention extends BaseIntentionAction {
function = (PyFunction)statementParent.addBefore(function, statement);
}
- function = CodeInsightUtilBase
+ function = CodeInsightUtilCore
.forcePsiPostprocessAndRestoreElement(function);
if (parent instanceof PyAssignmentStatement) {
@@ -97,8 +97,8 @@ public class PyConvertLambdaToFunctionIntention extends BaseIntentionAction {
PsiFile parentScope = lambdaExpression.getContainingFile();
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(parentScope);
PsiElement functionName = function.getNameIdentifier();
- functionName = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(functionName);
- lambdaExpression = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(lambdaExpression);
+ functionName = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(functionName);
+ lambdaExpression = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(lambdaExpression);
ReferenceNameExpression refExpr = new ReferenceNameExpression(name);
diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java
index cdb93416f71e..2646bd1c0484 100644
--- a/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java
+++ b/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.codeInsight.intentions;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.template.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
@@ -69,7 +69,7 @@ public class SpecifyTypeInPy3AnnotationsIntention extends TypeIntention {
final PyNamedParameter namedParameter = elementGenerator.createParameter(name, defaultParamText, PyNames.OBJECT, LanguageLevel.forElement(parameter));
assert namedParameter != null;
parameter = (PyParameter)parameter.replace(namedParameter);
- parameter = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(parameter);
+ parameter = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(parameter);
editor.getCaretModel().moveToOffset(parameter.getTextOffset());
PyAnnotation annotation = parameter instanceof PyNamedParameter? ((PyNamedParameter)parameter).getAnnotation() : null;
if (annotation != null) {
@@ -101,7 +101,7 @@ public class SpecifyTypeInPy3AnnotationsIntention extends TypeIntention {
final PyFunction function = elementGenerator.createFromText(LanguageLevel.forElement(callable), PyFunction.class,
functionText);
callable = (PyFunction)callable.replace(function);
- callable = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(callable);
+ callable = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(callable);
final PyAnnotation annotation = ((PyFunction)callable).getAnnotation();
assert annotation != null;
diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java
index d006d4d17831..b5421eeb325d 100644
--- a/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java
+++ b/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.codeInsight.intentions;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.template.*;
import com.intellij.openapi.editor.Document;
@@ -124,7 +124,7 @@ public class TypeAssertionIntention implements IntentionAction {
int textOffSet = element.getTextOffset();
editor.getCaretModel().moveToOffset(textOffSet);
- element = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(element);
+ element = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(element);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(element);
builder.replaceRange(TextRange.create(text.length()-1, text.length()-1), PyNames.OBJECT);
Template template = ((TemplateBuilderImpl)builder).buildInlineTemplate();
diff --git a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java
index 9b9c9f438fa2..79eb0470a7f4 100644
--- a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java
+++ b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.codeInsight.override;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.featureStatistics.ProductivityFeatureNames;
import com.intellij.ide.util.MemberChooser;
@@ -139,7 +139,7 @@ public class PyOverrideImplementUtil {
PyFunction baseFunction = (PyFunction) newMember.getPsiElement();
final PyFunctionBuilder builder = buildOverriddenFunction(pyClass, baseFunction);
PyFunction function = builder.addFunctionAfter(statementList, anchor, LanguageLevel.forElement(statementList));
- element = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(function);
+ element = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(function);
}
PyPsiUtils.removeRedundantPass(statementList);
diff --git a/python/src/com/jetbrains/python/documentation/PyDocstringGenerator.java b/python/src/com/jetbrains/python/documentation/PyDocstringGenerator.java
index 79b2a26087d7..3c66ef4ed5ba 100644
--- a/python/src/com/jetbrains/python/documentation/PyDocstringGenerator.java
+++ b/python/src/com/jetbrains/python/documentation/PyDocstringGenerator.java
@@ -4,7 +4,7 @@ import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.template.*;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
@@ -368,9 +368,9 @@ public class PyDocstringGenerator {
PyExpression str = elementGenerator.createDocstring(replacementToOffset.getFirst()).getExpression();
myDocStringExpression.replace(str);
if (myFunction != null) {
- myFunction = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(myFunction);
+ myFunction = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(myFunction);
}
- PyDocStringOwner owner = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(myDocStringOwner);
+ PyDocStringOwner owner = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(myDocStringOwner);
if (owner != null) {
myDocStringOwner = owner;
}
@@ -402,7 +402,7 @@ public class PyDocstringGenerator {
}
}
- myFunction = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(myFunction);
+ myFunction = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(myFunction);
myDocStringExpression = myFunction.getDocStringExpression();
}
}
diff --git a/python/src/com/jetbrains/python/findUsages/PyReadWriteAccessDetector.java b/python/src/com/jetbrains/python/findUsages/PyReadWriteAccessDetector.java
index 2971f8a5bf42..cd4ed1b0e97f 100644
--- a/python/src/com/jetbrains/python/findUsages/PyReadWriteAccessDetector.java
+++ b/python/src/com/jetbrains/python/findUsages/PyReadWriteAccessDetector.java
@@ -4,6 +4,7 @@ import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import com.jetbrains.python.psi.PyAugAssignmentStatement;
+import com.jetbrains.python.psi.PyDelStatement;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.PyTargetExpression;
import com.jetbrains.python.psi.impl.PyAugAssignmentStatementNavigator;
@@ -19,7 +20,7 @@ public class PyReadWriteAccessDetector extends ReadWriteAccessDetector {
@Override
public boolean isDeclarationWriteAccess(PsiElement element) {
- return element instanceof PyTargetExpression;
+ return element instanceof PyTargetExpression || element.getParent() instanceof PyDelStatement;
}
@Override
@@ -29,7 +30,7 @@ public class PyReadWriteAccessDetector extends ReadWriteAccessDetector {
@Override
public Access getExpressionAccess(PsiElement expression) {
- if (expression instanceof PyTargetExpression) {
+ if (isDeclarationWriteAccess(expression)) {
return Access.Write;
}
if (expression instanceof PyReferenceExpression) {
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/AddFieldQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/AddFieldQuickFix.java
index 9ce9da1938e0..dc0ef9d085b2 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/AddFieldQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/AddFieldQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
@@ -87,7 +87,7 @@ public class AddFieldQuickFix implements LocalQuickFix {
}
private void showTemplateBuilder(PsiElement initStatement) {
- initStatement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(initStatement);
+ initStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(initStatement);
if (initStatement instanceof PyAssignmentStatement) {
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(initStatement);
final PyExpression assignedValue = ((PyAssignmentStatement)initStatement).getAssignedValue();
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/AddFunctionQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/AddFunctionQuickFix.java
index 370358cbea20..cc67a715a211 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/AddFunctionQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/AddFunctionQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
@@ -96,7 +96,7 @@ public class AddFunctionQuickFix implements LocalQuickFix {
}
private static void showTemplateBuilder(PyFunction method) {
- method = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(method);
+ method = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(method);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(method);
ParamHelper.walkDownParamArray(
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java
index a7690b0c10b4..7770489fe1e9 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
@@ -125,7 +125,7 @@ public class AddMethodQuickFix implements LocalQuickFix {
}
private static void showTemplateBuilder(PyFunction method) {
- method = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(method);
+ method = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(method);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(method);
ParamHelper.walkDownParamArray(
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/CreateClassQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/CreateClassQuickFix.java
index f8097e792eb4..dc7a39517896 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/CreateClassQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/CreateClassQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
import com.intellij.codeInspection.LocalQuickFix;
@@ -57,7 +57,7 @@ public class CreateClassQuickFix implements LocalQuickFix {
else {
pyClass = (PyClass) anchor.getParent().addBefore(pyClass, anchor);
}
- pyClass = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(pyClass);
+ pyClass = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(pyClass);
TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(pyClass);
builder.replaceElement(pyClass.getSuperClassExpressions() [0], "object");
builder.replaceElement(pyClass.getStatementList(), PyNames.PASS);
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/StatementEffectIntroduceVariableQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/StatementEffectIntroduceVariableQuickFix.java
index 8001b0e6164b..3295519aa88a 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/StatementEffectIntroduceVariableQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/StatementEffectIntroduceVariableQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
import com.intellij.codeInspection.LocalQuickFix;
@@ -35,9 +35,9 @@ public class StatementEffectIntroduceVariableQuickFix implements LocalQuickFix {
final PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project);
final PyAssignmentStatement assignment = elementGenerator.createFromText(LanguageLevel.forElement(expression), PyAssignmentStatement.class,
"var = " + expression.getText());
-
+
expression = expression.replace(assignment);
- expression = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(expression);
+ expression = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(expression);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(expression);
builder.replaceElement(((PyAssignmentStatement)expression).getLeftHandSideExpression(), "var");
builder.run();
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefCreateFunctionQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefCreateFunctionQuickFix.java
index 73b7db96ff27..24c0bdd1c873 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefCreateFunctionQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefCreateFunctionQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
@@ -85,7 +85,7 @@ public class UnresolvedRefCreateFunctionQuickFix implements LocalQuickFix {
function = (PyFunction)parent.addBefore(function, statement);
}
}
- function = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(function);
+ function = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(function);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(function);
ParamHelper.walkDownParamArray(
function.getParameterList().getParameters(),
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedReferenceAddParameterQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedReferenceAddParameterQuickFix.java
index 807ee7aae35d..42f1e5a32e88 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedReferenceAddParameterQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedReferenceAddParameterQuickFix.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.inspections.quickfix;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.template.TemplateBuilder;
import com.intellij.codeInsight.template.TemplateBuilderFactory;
import com.intellij.codeInspection.LocalQuickFix;
@@ -45,7 +45,7 @@ public class UnresolvedReferenceAddParameterQuickFix implements LocalQuickFix {
if (function != null) {
final PyParameterList parameterList = function.getParameterList();
parameterList.addParameter(parameter);
- CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(parameterList);
+ CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(parameterList);
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(parameter);
builder.replaceRange(TextRange.create(parameter.getTextLength() - 4, parameter.getTextLength()), "None");
builder.run();
diff --git a/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java b/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java
index 305d1186c7af..5dd764b94488 100644
--- a/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java
+++ b/python/src/com/jetbrains/python/refactoring/classes/PyClassRefactoringUtil.java
@@ -7,7 +7,7 @@ import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiUtilBase;
+import com.intellij.psi.util.PsiUtilCore;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PythonFileType;
import com.jetbrains.python.codeInsight.PyCodeInsightSettings;
@@ -124,7 +124,7 @@ public class PyClassRefactoringUtil {
for (PyElement element : elements) {
final Set comments = PyUtil.getComments(element);
if (comments.size() > 0) {
- PyPsiUtils.removeElements(PsiUtilBase.toPsiElementArray(comments));
+ PyPsiUtils.removeElements(PsiUtilCore.toPsiElementArray(comments));
}
}
PyPsiUtils.removeElements(elements);
diff --git a/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java b/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java
index d61686268e12..aa6eed940301 100644
--- a/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java
+++ b/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.refactoring.extractmethod;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.codeFragment.CodeFragment;
import com.intellij.codeInsight.highlighting.HighlightManager;
import com.intellij.find.FindManager;
@@ -133,7 +133,7 @@ public class PyExtractMethodUtil {
// Replace statements with call
callElement = replaceElements(elementsRange, callElement);
- callElement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(callElement);
+ callElement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(callElement);
processDuplicates(callElement, generatedMethod, finder, editor);
// Set editor
@@ -186,7 +186,7 @@ public class PyExtractMethodUtil {
// replace statements with call
callElement = replaceElements(elementsRange, callElement);
- callElement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(callElement);
+ callElement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(callElement);
processDuplicates(callElement, generatedMethod, finder, editor);
// Set editor
diff --git a/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java b/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
index 0e8d0914f06a..411c34396743 100644
--- a/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
+++ b/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.refactoring.introduce;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
import com.intellij.lang.ASTNode;
@@ -143,7 +143,7 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
public Collection getSuggestedNames(@NotNull final PyExpression expression) {
Collection candidates = generateSuggestedNames(expression);
-
+
Collection res = new ArrayList();
for (String name : candidates) {
if (myValidator.checkPossibleName(name, expression)) {
@@ -160,7 +160,7 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
res.add(name + index);
}
}
-
+
return res;
}
@@ -441,7 +441,7 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
performIntroduceWithDialog(operation);
}
}
-
+
protected void performInplaceIntroduce(IntroduceOperation operation) {
final PsiElement statement = performRefactoring(operation);
if (statement instanceof PyAssignmentStatement) {
@@ -479,7 +479,7 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
PsiElement declaration = createDeclaration(operation);
declaration = performReplace(declaration, operation);
- declaration = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(declaration);
+ declaration = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(declaration);
return declaration;
}
@@ -494,10 +494,10 @@ abstract public class IntroduceHandler implements RefactoringActionHandler {
: PsiTreeUtil.getParentOfType(initializer, PyStatement.class);
return createDeclaration(project, assignmentText, anchor);
}
-
+
private static class InitializerTextBuilder extends PyRecursiveElementVisitor {
private final StringBuilder myResult = new StringBuilder();
-
+
@Override
public void visitWhiteSpace(PsiWhiteSpace space) {
myResult.append(space.getText().replace('\n', ' ').replace("\\", ""));
diff --git a/python/src/com/jetbrains/python/refactoring/introduce/parameter/PyIntroduceParameterHandler.java b/python/src/com/jetbrains/python/refactoring/introduce/parameter/PyIntroduceParameterHandler.java
index e72aca56ec5c..2cac148e809c 100644
--- a/python/src/com/jetbrains/python/refactoring/introduce/parameter/PyIntroduceParameterHandler.java
+++ b/python/src/com/jetbrains/python/refactoring/introduce/parameter/PyIntroduceParameterHandler.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.refactoring.introduce.parameter;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.PsiReference;
@@ -48,7 +48,7 @@ public class PyIntroduceParameterHandler extends IntroduceHandler {
if (function != null && declaration != null) {
PyParameterList parameterList = function.getParameterList();
parameterList.addParameter(PyElementGenerator.getInstance(function.getProject()).createParameter(declaration.getText()));
- CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(function);
+ CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(function);
return parameterList.findParameterByName(declaration.getTargets()[0].getText());
}
return null;
diff --git a/python/src/com/jetbrains/python/refactoring/invertBoolean/PyInvertBooleanDialog.java b/python/src/com/jetbrains/python/refactoring/invertBoolean/PyInvertBooleanDialog.java
index a7987e91f90c..b0a5996ca6ce 100644
--- a/python/src/com/jetbrains/python/refactoring/invertBoolean/PyInvertBooleanDialog.java
+++ b/python/src/com/jetbrains/python/refactoring/invertBoolean/PyInvertBooleanDialog.java
@@ -1,5 +1,6 @@
package com.jetbrains.python.refactoring.invertBoolean;
+import com.intellij.lang.findUsages.DescriptiveNameUtil;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNamedElement;
@@ -33,7 +34,7 @@ public class PyInvertBooleanDialog extends RefactoringDialog {
myLabel.setText(RefactoringBundle.message("invert.boolean.name.of.inverted.element", typeString));
myCaptionLabel.setText(RefactoringBundle.message("invert.0.1",
typeString,
- UsageViewUtil.getDescriptiveName(myElement)));
+ DescriptiveNameUtil.getDescriptiveName(myElement)));
setTitle(PyInvertBooleanHandler.REFACTORING_NAME);
init();
diff --git a/python/src/com/jetbrains/python/refactoring/surround/surrounders/expressions/PyWithParenthesesSurrounder.java b/python/src/com/jetbrains/python/refactoring/surround/surrounders/expressions/PyWithParenthesesSurrounder.java
index 2d2e1c5378b7..8dfe142285ea 100644
--- a/python/src/com/jetbrains/python/refactoring/surround/surrounders/expressions/PyWithParenthesesSurrounder.java
+++ b/python/src/com/jetbrains/python/refactoring/surround/surrounders/expressions/PyWithParenthesesSurrounder.java
@@ -1,7 +1,7 @@
package com.jetbrains.python.refactoring.surround.surrounders.expressions;
import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -34,7 +34,7 @@ public class PyWithParenthesesSurrounder extends PyExpressionSurrounder {
assert expression != null;
expression.replace(element);
element = (PyExpression) element.replace(parenthesesExpression);
- element = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(element);
+ element = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(element);
return element.getTextRange();
}
}
diff --git a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfElseSurrounder.java b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfElseSurrounder.java
index 9dfc7ebf9464..e123f242ccf0 100644
--- a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfElseSurrounder.java
+++ b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfElseSurrounder.java
@@ -1,7 +1,7 @@
package com.jetbrains.python.refactoring.surround.surrounders.statements;
import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -36,7 +36,7 @@ public class PyWithIfElseSurrounder extends PyStatementSurrounder {
ifStatement = (PyIfStatement) parent.addBefore(ifStatement, elements[0]);
parent.deleteChildRange(elements[0], elements[elements.length - 1]);
- ifStatement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(ifStatement);
+ ifStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(ifStatement);
if (ifStatement == null) {
return null;
}
diff --git a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfSurrounder.java b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfSurrounder.java
index de1a6bb22f2c..2b5a50c21dea 100644
--- a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfSurrounder.java
+++ b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithIfSurrounder.java
@@ -1,7 +1,7 @@
package com.jetbrains.python.refactoring.surround.surrounders.statements;
import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -30,7 +30,7 @@ public class PyWithIfSurrounder extends PyStatementSurrounder {
ifStatement = (PyIfStatement) parent.addBefore(ifStatement, elements[0]);
parent.deleteChildRange(elements[0], elements[elements.length - 1]);
- ifStatement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(ifStatement);
+ ifStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(ifStatement);
if (ifStatement == null) {
return null;
}
diff --git a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithReturnSurrounder.java b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithReturnSurrounder.java
index 0a75cfa9147c..32d9997b5c0c 100644
--- a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithReturnSurrounder.java
+++ b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithReturnSurrounder.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.refactoring.surround.surrounders.statements;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -36,7 +36,7 @@ public class PyWithReturnSurrounder extends PyStatementSurrounder {
PsiElement element = elements[0];
expression.replace(element);
element = element.replace(returnStatement);
- element = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(element);
+ element = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(element);
return element.getTextRange();
}
diff --git a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileElseSurrounder.java b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileElseSurrounder.java
index 8ddad36cc62d..1f2f54b6a68c 100644
--- a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileElseSurrounder.java
+++ b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileElseSurrounder.java
@@ -1,6 +1,6 @@
package com.jetbrains.python.refactoring.surround.surrounders.statements;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -31,7 +31,7 @@ public class PyWithWhileElseSurrounder extends PyStatementSurrounder {
whileStatement = (PyWhileStatement) parent.addBefore(whileStatement, elements[0]);
parent.deleteChildRange(elements[0], elements[elements.length - 1]);
- whileStatement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(whileStatement);
+ whileStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(whileStatement);
if (whileStatement == null) {
return null;
}
diff --git a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileSurrounder.java b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileSurrounder.java
index 9e9b6196e0a8..66809fdb4294 100644
--- a/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileSurrounder.java
+++ b/python/src/com/jetbrains/python/refactoring/surround/surrounders/statements/PyWithWhileSurrounder.java
@@ -1,7 +1,7 @@
package com.jetbrains.python.refactoring.surround.surrounders.statements;
import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -31,7 +31,7 @@ public class PyWithWhileSurrounder extends PyStatementSurrounder{
whileStatement = (PyWhileStatement) parent.addBefore(whileStatement, elements[0]);
parent.deleteChildRange(elements[0], elements[elements.length - 1]);
- whileStatement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(whileStatement);
+ whileStatement = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(whileStatement);
if (whileStatement == null) {
return null;
}
diff --git a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
index 5b0124fb15c2..5d99ae35f70f 100644
--- a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
+++ b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java
@@ -13,6 +13,7 @@ import com.intellij.lang.annotation.ExternalAnnotator;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
import com.intellij.openapi.module.ModuleUtilCore;
@@ -23,6 +24,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
+import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiWhiteSpace;
@@ -141,9 +143,14 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator