Fix auto-indent for {
This commit is contained in:
committed by
Nikolay Krasko
parent
99ddfe8c83
commit
9ed900e2be
@@ -76,8 +76,8 @@ public class KotlinTypedHandler extends TypedHandlerDelegate {
|
||||
if (previousElement instanceof LeafPsiElement
|
||||
&& ((LeafPsiElement) previousElement).getElementType() == JetTokens.LONG_TEMPLATE_ENTRY_START) {
|
||||
editor.getDocument().insertString(offset, "}");
|
||||
return Result.STOP;
|
||||
}
|
||||
return Result.STOP;
|
||||
}
|
||||
|
||||
return Result.CONTINUE;
|
||||
|
||||
@@ -26,6 +26,30 @@ public class TypedHandlerTest extends LightCodeInsightTestCase {
|
||||
checkResultByText("val x = \"${}\"");
|
||||
}
|
||||
|
||||
public void testAutoIndentRightOpenBrace() throws Exception {
|
||||
configureFromFileText("a.kt",
|
||||
"fun test() {\n" +
|
||||
"<caret>\n" +
|
||||
"}");
|
||||
EditorTestUtil.performTypingAction(getEditor(), '{');
|
||||
checkResultByText(
|
||||
"fun test() {\n" +
|
||||
" {<caret>}\n" +
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testAutoIndentLeftOpenBrace() throws Exception {
|
||||
configureFromFileText("a.kt",
|
||||
"fun test() {\n" +
|
||||
" <caret>\n" +
|
||||
"}");
|
||||
EditorTestUtil.performTypingAction(getEditor(), '{');
|
||||
checkResultByText(
|
||||
"fun test() {\n" +
|
||||
" {<caret>}\n" +
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testTypeStringTemplateStartWithCloseBraceAfter() throws Exception {
|
||||
configureFromFileText("a.kt", "fun foo() { \"$<caret>\" }");
|
||||
EditorTestUtil.performTypingAction(getEditor(), '{');
|
||||
|
||||
Reference in New Issue
Block a user