gstring reformatting fix

This commit is contained in:
Maxim Medvedev
2009-11-16 19:00:17 +03:00
parent 5d3a8e4205
commit 3a8cb8f86b
3 changed files with 17 additions and 0 deletions
@@ -100,6 +100,19 @@ public class GroovyBlockGenerator implements GroovyElementTypes {
}
//for gstrings
if (block.getNode().getElementType() == GSTRING) {
final ArrayList<Block> subBlocks = new ArrayList<Block>();
ASTNode children[] = getGroovyChildren(node);
ASTNode prevChildNode = null;
for (ASTNode childNode : children) {
final Indent indent = GroovyIndentProcessor.getChildIndent(block, prevChildNode, childNode);
subBlocks.add(new GroovyBlock(childNode, myAlignment, indent, myWrap, mySettings));
prevChildNode = childNode;
}
return subBlocks;
}
//For nested selections
if (NESTED.contains(block.getNode().getElementType()) &&
blockPsi.getParent() != null &&
@@ -65,6 +65,7 @@ public class FormatterTest extends GroovyFormatterTestCase {
public void testFor2() throws Throwable { doTest(); }
public void testGbegin1() throws Throwable { doTest(); }
public void testGrvy1637() throws Throwable { doTest(); }
public void testGString1() throws Throwable { doTest(); }
public void testMap6() throws Throwable { doTest(); }
public void testMeth1() throws Throwable { doTest(); }
public void testMeth2() throws Throwable { doTest(); }
@@ -0,0 +1,3 @@
def a = "${1+2} ${2}"
-----
def a = "${1 + 2} ${2}"