Use our own tail handler

This commit is contained in:
Valentin Kipyatkov
2014-11-14 14:38:32 +03:00
parent 7077e22dd3
commit 58a67a2bf3
2 changed files with 2 additions and 5 deletions
@@ -16,12 +16,9 @@
package org.jetbrains.jet.plugin.completion.handlers
import com.google.common.collect.Sets
import com.intellij.codeInsight.TailType
import com.intellij.codeInsight.completion.InsertHandler
import com.intellij.codeInsight.completion.InsertionContext
import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.jet.lang.psi.JetFunction
import org.jetbrains.jet.lang.psi.JetPsiUtil
@@ -54,7 +51,6 @@ public object KotlinKeywordInsertHandler : InsertHandler<LookupElement> {
}
// Add space after keyword
context.setAddCompletionChar(false)
TailType.SPACE.processTail(context.getEditor(), context.getTailOffset())
WithTailInsertHandler.spaceTail().postHandleInsert(context, item)
}
}
@@ -90,5 +90,6 @@ class WithTailInsertHandler(val tailText: String,
fun rparenthTail() = WithTailInsertHandler(")", spaceBefore = false, spaceAfter = false)
fun elseTail() = WithTailInsertHandler("else", spaceBefore = true, spaceAfter = true)
fun eqTail() = WithTailInsertHandler("=", spaceBefore = true, spaceAfter = true) /*TODO: use code style options*/
fun spaceTail() = WithTailInsertHandler(" ", spaceBefore = false, spaceAfter = false)
}
}