honor "blank lines around functions" for class followed by a function (PY-675)

This commit is contained in:
Dmitry Jemerov
2010-03-12 22:22:51 +03:00
parent 8bb69371a8
commit ded5bc0db1
4 changed files with 10 additions and 1 deletions
@@ -185,7 +185,7 @@ public class PyBlock implements ASTBlock {
IElementType type1 = childNode1.getElementType();
IElementType type2 = childNode2.getElementType();
if (type1 == PyElementTypes.FUNCTION_DECLARATION) {
if (type1 == PyElementTypes.FUNCTION_DECLARATION || (type2 == PyElementTypes.FUNCTION_DECLARATION && type1 == PyElementTypes.CLASS_DECLARATION)) {
int blankLines = mySettings.BLANK_LINES_AROUND_METHOD + 1;
return Spacing.createSpacing(0, 0, blankLines, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_DECLARATIONS);
}
@@ -1,3 +1,5 @@
class C:
pass
def foo():
pass
def bar():
@@ -1,3 +1,6 @@
class C:
pass
def foo():
pass
@@ -9,6 +9,10 @@ import com.jetbrains.python.fixtures.PyLightFixtureTestCase;
*/
public class PyFormatterTest extends PyLightFixtureTestCase {
public void testBlankLineBetweenMethods() throws Exception {
doTest();
}
private void doTest() throws Exception {
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {