From ec39d9caae99cc51bf08deef2cd06897d0efeeda Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Wed, 1 Feb 2012 22:10:02 +0400 Subject: [PATCH] Added oneline if-else template. --- .../plugin/completion/JetKeywordCompletionContributor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/JetKeywordCompletionContributor.java b/idea/src/org/jetbrains/jet/plugin/completion/JetKeywordCompletionContributor.java index 7f749a1bfe3..e7a9f190138 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/JetKeywordCompletionContributor.java +++ b/idea/src/org/jetbrains/jet/plugin/completion/JetKeywordCompletionContributor.java @@ -52,6 +52,7 @@ public class JetKeywordCompletionContributor extends CompletionContributor { private static final String IF_TEMPLATE = "if (<##>) {\n<##>\n}"; private static final String IF_ELSE_TEMPLATE = "if (<##>) {\n<##>\n} else {\n<##>\n}"; + private static final String IF_ELSE_ONELINE_TEMPLATE = "if (<##>) <##> else <##>"; private static final String FUN_TEMPLATE = "fun <##>(<##>) : <##> {\n<##>\n}"; private static class CommentFilter implements ElementFilter { @@ -226,8 +227,8 @@ public class JetKeywordCompletionContributor extends CompletionContributor { // templates registerScopeKeywordsCompletion(new InTopFilter(), FUN_TEMPLATE); registerScopeKeywordsCompletion(new InClassBodyFilter(), FUN_TEMPLATE); - registerScopeKeywordsCompletion(new InNonClassBlockFilter(), IF_TEMPLATE, IF_ELSE_TEMPLATE, FUN_TEMPLATE); - registerScopeKeywordsCompletion(new InPropertyFilter(), IF_ELSE_TEMPLATE, IF_TEMPLATE); + registerScopeKeywordsCompletion(new InNonClassBlockFilter(), IF_TEMPLATE, IF_ELSE_TEMPLATE, IF_ELSE_ONELINE_TEMPLATE, FUN_TEMPLATE); + registerScopeKeywordsCompletion(new InPropertyFilter(), IF_ELSE_ONELINE_TEMPLATE); registerScopeKeywordsCompletion(new InParametersFilter(), ArrayUtil.EMPTY_STRING_ARRAY); }