mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-20744 Python formatter is aware of variable annotations
This commit is contained in:
@@ -95,6 +95,8 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
|
||||
.betweenInside(MINUS, GT, ANNOTATION).none()
|
||||
.beforeInside(ANNOTATION, FUNCTION_DECLARATION).spaces(1)
|
||||
.beforeInside(ANNOTATION, NAMED_PARAMETER).none()
|
||||
.beforeInside(ANNOTATION, TYPE_DECLARATION_STATEMENT).none()
|
||||
.beforeInside(ANNOTATION, ASSIGNMENT_STATEMENT).none()
|
||||
.afterInside(COLON, ANNOTATION).spaces(1)
|
||||
.afterInside(RARROW, ANNOTATION).spaces(1)
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
x : int
|
||||
y : Optional[str] = 'foo'
|
||||
@@ -0,0 +1,2 @@
|
||||
x: int
|
||||
y: Optional[str] = 'foo'
|
||||
@@ -673,4 +673,8 @@ public class PyFormatterTest extends PyTestCase {
|
||||
getCommonCodeStyleSettings().SPACE_AFTER_COMMA = false;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVariableAnnotations() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user