smart indent on paste for Python (PY-208)

This commit is contained in:
Dmitry Jemerov
2010-09-07 23:12:34 +04:00
parent 2b4b4f3044
commit e311373524
8 changed files with 46 additions and 0 deletions
@@ -175,6 +175,8 @@
<moduleService serviceInterface="com.jetbrains.python.psi.resolve.PythonPathCache"
serviceImplementation="com.jetbrains.python.psi.resolve.PythonPathCache"/>
<copyPastePostProcessor implementation="com.jetbrains.python.codeInsight.CopyPasteIndentProcessor"/>
<!-- Django -->
<codeInsight.lineMarkerProvider language="Python" implementationClass="com.jetbrains.django.annotator.ViewMethodLineMarkerProvider"/>
<configurationType implementation="com.jetbrains.django.run.DjangoServerRunConfigurationType"/>
@@ -0,0 +1,3 @@
def bar():
x = 1
y = 2
+2
View File
@@ -0,0 +1,2 @@
def bar():
<caret>
+4
View File
@@ -0,0 +1,4 @@
class C:
def foo(self):
<selection> x = 1
y = 2</selection>
@@ -0,0 +1,3 @@
def bar():
x = 1
y = 2
+2
View File
@@ -0,0 +1,2 @@
def bar():
<caret>
+4
View File
@@ -0,0 +1,4 @@
class C:
def foo(self):
<selection>x = 1
y = 2</selection>
@@ -0,0 +1,26 @@
package com.jetbrains.python;
import com.intellij.openapi.actionSystem.IdeActions;
import com.jetbrains.python.fixtures.PyLightFixtureTestCase;
/**
* @author yole
*/
public class PyCopyPasteTest extends PyLightFixtureTestCase {
public void testIndent1() {
doTest();
}
public void testIndent2() {
doTest();
}
private void doTest() {
String name = getTestName(false);
myFixture.configureByFile("copyPaste/" + name + ".src.py");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_COPY);
myFixture.configureByFile("copyPaste/"+ name + ".dst.py");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PASTE);
myFixture.checkResultByFile("copyPaste/" + name + ".after.py");
}
}