mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
no space after star in star expression (PY-1523)
This commit is contained in:
@@ -285,7 +285,9 @@ public class PyBlock implements ASTBlock {
|
||||
return getSpacingForOption(mySettings.SPACE_AROUND_ADDITIVE_OPERATORS);
|
||||
}
|
||||
if (isAround(type1, type2, PyTokenTypes.MULTIPLICATIVE_OPERATIONS) || type1 == PyTokenTypes.EXP || type2 == PyTokenTypes.EXP) {
|
||||
if (parentType == PyElementTypes.NAMED_PARAMETER || parentType == PyElementTypes.STAR_ARGUMENT_EXPRESSION) {
|
||||
if (parentType == PyElementTypes.NAMED_PARAMETER ||
|
||||
parentType == PyElementTypes.STAR_ARGUMENT_EXPRESSION ||
|
||||
parentType == PyElementTypes.STAR_EXPRESSION) {
|
||||
return Spacing.createSpacing(0, 0, 0, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
}
|
||||
return getSpacingForOption(mySettings.SPACE_AROUND_MULTIPLICATIVE_OPERATORS);
|
||||
|
||||
1
python/testData/formatter/starExpression.py
Normal file
1
python/testData/formatter/starExpression.py
Normal file
@@ -0,0 +1 @@
|
||||
a, * b, c = range(5)
|
||||
1
python/testData/formatter/starExpression_after.py
Normal file
1
python/testData/formatter/starExpression_after.py
Normal file
@@ -0,0 +1 @@
|
||||
a, *b, c = range(5)
|
||||
@@ -3,6 +3,8 @@ package com.jetbrains.python;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.jetbrains.python.fixtures.PyLightFixtureTestCase;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -52,6 +54,16 @@ public class PyFormatterTest extends PyLightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStarExpression() { // PY-1523
|
||||
PythonLanguageLevelPusher.setForcedLanguageLevel(myFixture.getProject(), LanguageLevel.PYTHON30);
|
||||
try {
|
||||
doTest();
|
||||
}
|
||||
finally {
|
||||
PythonLanguageLevelPusher.setForcedLanguageLevel(myFixture.getProject(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user