Completion: no "else" in first when entry

This commit is contained in:
Valentin Kipyatkov
2015-04-09 19:45:45 +03:00
parent 3faf6cc3e8
commit 3fad68ad4c
6 changed files with 7 additions and 4 deletions
@@ -34,7 +34,8 @@ object KeywordValues {
if (whenCondition != null) {
val entry = whenCondition.getParent() as JetWhenEntry
val whenExpression = entry.getParent() as JetWhenExpression
if (whenExpression.getElseExpression() == null && entry == whenExpression.getEntries().last) {
val entries = whenExpression.getEntries()
if (whenExpression.getElseExpression() == null && entry == entries.last() && entries.size() != 1) {
val lookupElement = LookupElementBuilder.create("else").bold().withTailText(" ->")
collection.add(object: LookupElementDecorator<LookupElement>(lookupElement) {
override fun handleInsert(context: InsertionContext) {