mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
honor "blank lines around functions" for class followed by a function (PY-675)
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user