mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
blank line between statement and function (PY-1007)
This commit is contained in:
@@ -201,7 +201,8 @@ public class PyBlock implements ASTBlock {
|
||||
if (type1 == PyElementTypes.CLASS_DECLARATION) {
|
||||
return getBlankLinesForOption(mySettings.BLANK_LINES_AROUND_CLASS);
|
||||
}
|
||||
if (type1 == PyElementTypes.FUNCTION_DECLARATION || (type2 == PyElementTypes.FUNCTION_DECLARATION && type1 == PyElementTypes.CLASS_DECLARATION)) {
|
||||
if (type1 == PyElementTypes.FUNCTION_DECLARATION ||
|
||||
(type2 == PyElementTypes.FUNCTION_DECLARATION && isStatementOrDeclaration(type1))) {
|
||||
return getBlankLinesForOption(mySettings.BLANK_LINES_AROUND_METHOD);
|
||||
}
|
||||
if (isImportStatement(type1) && (isStatementOrDeclaration(type2) && !isImportStatement(type2))) {
|
||||
|
||||
3
python/testData/formatter/blankLineBeforeFunction.py
Normal file
3
python/testData/formatter/blankLineBeforeFunction.py
Normal file
@@ -0,0 +1,3 @@
|
||||
class C:
|
||||
x = 1
|
||||
def foo(self): pass
|
||||
@@ -0,0 +1,4 @@
|
||||
class C:
|
||||
x = 1
|
||||
|
||||
def foo(self): pass
|
||||
@@ -40,6 +40,10 @@ public class PyFormatterTest extends PyLightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testBlankLineBeforeFunction() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user