mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -170,8 +170,8 @@ private layoutPlugins(layouts) {
|
||||
}
|
||||
dir("lib") {
|
||||
fileset(dir: "${home}/plugins/textmate/lib") {
|
||||
include("jcodings.jar")
|
||||
include("joni.jar")
|
||||
include(name: "jcodings.jar")
|
||||
include(name: "joni.jar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,9 +192,13 @@ public class PyBlock implements ASTBlock {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
else if ((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION || parentType == PyElementTypes.GENERATOR_EXPRESSION) &&
|
||||
hasLineBreaksBefore(child, 1)) {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
else if ((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION || parentType == PyElementTypes.GENERATOR_EXPRESSION)) {
|
||||
if (childType == PyTokenTypes.RPAR || !hasLineBreaksBefore(child, 1)) {
|
||||
childIndent = Indent.getNoneIndent();
|
||||
}
|
||||
else {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
|
||||
if (isAfterStatementList(child) && !hasLineBreaksBefore(child, 2)) { // maybe enter was pressed and cut us from a previous (nested) statement list
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PyLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettin
|
||||
SPACES_AROUND_OPERATORS);
|
||||
consumer.showCustomOption(PyCodeStyleSettings.class, "SPACE_AROUND_EQ_IN_KEYWORD_ARGUMENT", "Around = in keyword argument",
|
||||
SPACES_AROUND_OPERATORS);
|
||||
consumer.showCustomOption(PyCodeStyleSettings.class, "SPACE_WITHIN_BRACES", "Within braces", SPACES_WITHIN);
|
||||
consumer.showCustomOption(PyCodeStyleSettings.class, "SPACE_WITHIN_BRACES", "Braces", SPACES_WITHIN);
|
||||
consumer.showCustomOption(PyCodeStyleSettings.class, "SPACE_BEFORE_PY_COLON", ApplicationBundle.message("checkbox.spaces.before.colon"), SPACES_OTHER);
|
||||
consumer.showCustomOption(PyCodeStyleSettings.class, "SPACE_AFTER_PY_COLON", ApplicationBundle.message("checkbox.spaces.after.colon"), SPACES_OTHER);
|
||||
}
|
||||
|
||||
@@ -80,12 +80,13 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
|
||||
.after(COMMA).spaceIf(commonSettings.SPACE_AFTER_COMMA)
|
||||
.before(COMMA).spaceIf(commonSettings.SPACE_BEFORE_COMMA)
|
||||
.between(FROM_KEYWORD, DOT).spaces(1)
|
||||
.between(DOT, IMPORT_KEYWORD).spaces(1)
|
||||
.around(DOT).spaces(0)
|
||||
.before(SEMICOLON).spaceIf(commonSettings.SPACE_BEFORE_SEMICOLON)
|
||||
.withinPairInside(LPAR, RPAR, ARGUMENT_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES)
|
||||
.before(LBRACKET).spaceIf(pySettings.SPACE_BEFORE_LBRACKET)
|
||||
|
||||
.withinPair(LBRACE, RBRACE).spaceIf(commonSettings.SPACE_WITHIN_BRACES)
|
||||
.withinPair(LBRACE, RBRACE).spaceIf(pySettings.SPACE_WITHIN_BRACES)
|
||||
.withinPair(LBRACKET, RBRACKET).spaceIf(commonSettings.SPACE_WITHIN_BRACKETS)
|
||||
|
||||
.before(ARGUMENT_LIST).spaceIf(commonSettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES)
|
||||
|
||||
@@ -34,6 +34,10 @@ public class PyMoveFileHandler extends MoveFileHandler {
|
||||
@Override
|
||||
public void prepareMovedFile(PsiFile file, PsiDirectory moveDestination, Map<PsiElement, PsiElement> oldToNewMap) {
|
||||
if (file != null) {
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
PyUtil.deletePycFiles(virtualFile.getPath());
|
||||
}
|
||||
final Collection<VirtualFile> roots = PyUtil.getSourceRoots(file);
|
||||
PsiDirectory root = moveDestination;
|
||||
while (root != null && !roots.contains(root.getVirtualFile())) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from . import x
|
||||
@@ -0,0 +1 @@
|
||||
from . import x
|
||||
@@ -0,0 +1 @@
|
||||
dict = {1: 'a', 2: 'b', 3: 'c'}
|
||||
@@ -0,0 +1 @@
|
||||
dict = { 1: 'a', 2: 'b', 3: 'c' }
|
||||
@@ -0,0 +1,4 @@
|
||||
tuple = (
|
||||
'value',
|
||||
'value',
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
tuple = (
|
||||
'value',
|
||||
'value',
|
||||
)
|
||||
@@ -4,4 +4,4 @@ if True:
|
||||
'\n'
|
||||
' Let\'s go.\n'
|
||||
' And they went out.'
|
||||
)
|
||||
)
|
||||
@@ -7,6 +7,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
import com.jetbrains.python.formatter.PyCodeStyleSettings;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.PyElementGenerator;
|
||||
import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher;
|
||||
@@ -191,6 +192,19 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSpaceAfterRelativeImport() { // PY-8112
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSpaceWithinBraces() { // PY-8069
|
||||
settings().getCustomSettings(PyCodeStyleSettings.class).SPACE_WITHIN_BRACES = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTupleClosingParen() { // PY-7946
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPsiFormatting() { // IDEA-69724
|
||||
String initial =
|
||||
"def method_name(\n" +
|
||||
|
||||
Reference in New Issue
Block a user