KT-2572 Cursor position on Enter after 'try'
#KT-2575 Fixed
This commit is contained in:
@@ -58,12 +58,12 @@ public abstract class ASTIndentStrategy {
|
|||||||
public static class PositionStrategy extends ASTIndentStrategy {
|
public static class PositionStrategy extends ASTIndentStrategy {
|
||||||
private Indent defaultIndent = Indent.getNoneIndent();
|
private Indent defaultIndent = Indent.getNoneIndent();
|
||||||
|
|
||||||
private List<IElementType> in = new ArrayList<IElementType>();
|
private final List<IElementType> in = new ArrayList<IElementType>();
|
||||||
private List<IElementType> notIn = new ArrayList<IElementType>();
|
private final List<IElementType> notIn = new ArrayList<IElementType>();
|
||||||
private List<IElementType> forElement = new ArrayList<IElementType>();
|
private final List<IElementType> forElement = new ArrayList<IElementType>();
|
||||||
private List<IElementType> notForElement = new ArrayList<IElementType>();
|
private final List<IElementType> notForElement = new ArrayList<IElementType>();
|
||||||
|
|
||||||
private String debugInfo;
|
private final String debugInfo;
|
||||||
|
|
||||||
public PositionStrategy(@Nullable String debugInfo) {
|
public PositionStrategy(@Nullable String debugInfo) {
|
||||||
this.debugInfo = debugInfo;
|
this.debugInfo = debugInfo;
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ public class JetBlock extends AbstractBlock {
|
|||||||
|
|
||||||
return new ChildAttributes(Indent.getNormalIndent(), null);
|
return new ChildAttributes(Indent.getNormalIndent(), null);
|
||||||
}
|
}
|
||||||
|
else if (type == JetNodeTypes.TRY) {
|
||||||
|
// In try - try BLOCK catch BLOCK finally BLOCK
|
||||||
|
return new ChildAttributes(Indent.getNoneIndent(), null);
|
||||||
|
}
|
||||||
else if (type == JetNodeTypes.DOT_QUALIFIED_EXPRESSION) {
|
else if (type == JetNodeTypes.DOT_QUALIFIED_EXPRESSION) {
|
||||||
return new ChildAttributes(Indent.getContinuationWithoutFirstIndent(), null);
|
return new ChildAttributes(Indent.getContinuationWithoutFirstIndent(), null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
fun some(): Int {
|
||||||
|
try {
|
||||||
|
}
|
||||||
|
catch () {
|
||||||
|
}<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fun some(): Int {
|
||||||
|
try {
|
||||||
|
}
|
||||||
|
catch () {
|
||||||
|
}
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fun some(): Int {
|
||||||
|
try {
|
||||||
|
}
|
||||||
|
catch () {
|
||||||
|
}
|
||||||
|
finally {}<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fun some(): Int {
|
||||||
|
try {
|
||||||
|
}
|
||||||
|
catch () {
|
||||||
|
}
|
||||||
|
finally {}
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun some(): Int {
|
||||||
|
try {
|
||||||
|
}<caret>
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun some(): Int {
|
||||||
|
try {
|
||||||
|
}
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
@@ -29,10 +29,22 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public class JetTypingIndentationTest extends LightCodeInsightTestCase {
|
public class JetTypingIndentationTest extends LightCodeInsightTestCase {
|
||||||
|
|
||||||
|
public void testAfterCatch() {
|
||||||
|
doFileNewlineTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAfterFinally() {
|
||||||
|
doFileNewlineTest();
|
||||||
|
}
|
||||||
|
|
||||||
public void testAfterImport() {
|
public void testAfterImport() {
|
||||||
doFileNewlineTest();
|
doFileNewlineTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAfterTry() {
|
||||||
|
doFileNewlineTest();
|
||||||
|
}
|
||||||
|
|
||||||
public void testConsecutiveCallsAfterDot() {
|
public void testConsecutiveCallsAfterDot() {
|
||||||
doFileNewlineTest();
|
doFileNewlineTest();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user