mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-15171 Detect hanging indent in the value of key-value pair in dict literals
This commit is contained in:
@@ -407,6 +407,10 @@ public class PyBlock implements ASTBlock {
|
||||
final PyExpression valueExpression = ((PyKeywordArgument)firstItem).getValueExpression();
|
||||
return valueExpression != null && hasHangingIndent(valueExpression);
|
||||
}
|
||||
else if (firstItem instanceof PyKeyValueExpression) {
|
||||
final PyExpression value = ((PyKeyValueExpression)firstItem).getValue();
|
||||
return value != null && hasHangingIndent(value);
|
||||
}
|
||||
return hasHangingIndent(firstItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
example = {'breakfast': {
|
||||
'eggs': 1,
|
||||
'spam': 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
example = {'breakfast': {
|
||||
'eggs': 1,
|
||||
'spam': 2
|
||||
}
|
||||
}
|
||||
@@ -559,6 +559,11 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-15171
|
||||
public void testHangingIndentInKeyValuePair() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAlignmentOfEmptyCollectionLiterals() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user