IDEA-51918 Smart enter moves caret to parent code block in Groovy

This commit is contained in:
peter
2010-02-03 16:26:35 +00:00
parent 6e80e9ae08
commit 46c9431d88
4 changed files with 20 additions and 1 deletions
@@ -266,7 +266,7 @@ public class GroovySmartEnterProcessor extends SmartEnterProcessor {
if (statementAtCaret instanceof GrBlockStatement) return null;
if (statementAtCaret == null) return null;
GrControlStatement controlStatement = PsiTreeUtil.getParentOfType(statementAtCaret, GrControlStatement.class);
GrControlStatement controlStatement = PsiTreeUtil.getParentOfType(statementAtCaret, GrControlStatement.class, false);
if (controlStatement != null && !PsiTreeUtil.hasErrorElements(statementAtCaret)) {
return controlStatement;
@@ -37,6 +37,7 @@ public class SmartEnterTest extends LightCodeInsightFixtureTestCase {
public void testMissRQuoteInCompStr() throws Throwable { doTest(); }
public void testGotoNextLineInFor() throws Throwable { doTest(); }
public void testGotoParentInIf() throws Throwable { doTest(); }
protected static List<SmartEnterProcessor> getSmartProcessors(Language grLanguage) {
return SmartEnterProcessors.INSTANCE.forKey(grLanguage);
@@ -0,0 +1,13 @@
if (suitable) {
expectations.each {pattern, action ->
if (cloud.match(pattern, action))<caret>
}
}
-----
if (suitable) {
expectations.each {pattern, action ->
if (cloud.match(pattern, action)) {
<caret>
}
}
}
@@ -0,0 +1,5 @@
def promote(List active) {
if (f) {
active.removeLast()
}
}