more keywords which allow only 1 space around them

This commit is contained in:
Dmitry Jemerov
2012-10-02 20:04:47 +02:00
parent aec0179906
commit 3dbc0cd0c0
4 changed files with 10 additions and 1 deletions
@@ -105,9 +105,12 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
.around(BITWISE_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_BITWISE_OPERATORS)
.around(EQUALITY_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_EQUALITY_OPERATORS)
.around(RELATIONAL_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_RELATIONAL_OPERATORS)
.around(IN_KEYWORD).spaces(1);
.around(SINGLE_SPACE_KEYWORDS).spaces(1);
}
// should be all keywords?
private static final TokenSet SINGLE_SPACE_KEYWORDS = TokenSet.create(IN_KEYWORD, AND_KEYWORD, OR_KEYWORD, IS_KEYWORD);
private static TokenSet allButLambda() {
final PythonLanguage pythonLanguage = PythonLanguage.getInstance();
return TokenSet.create(IElementType.enumerate(new IElementType.Predicate() {
@@ -0,0 +1 @@
True and False
@@ -0,0 +1 @@
True and False
@@ -183,6 +183,10 @@ public class PyFormatterTest extends PyTestCase {
doTest();
}
public void testSpaceAroundKeywords() {
doTest();
}
public void testPsiFormatting() { // IDEA-69724
String initial =
"def method_name(\n" +