Use our own tail handler
This commit is contained in:
@@ -16,12 +16,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.plugin.completion.handlers
|
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.InsertHandler
|
||||||
import com.intellij.codeInsight.completion.InsertionContext
|
import com.intellij.codeInsight.completion.InsertionContext
|
||||||
import com.intellij.codeInsight.lookup.LookupElement
|
import com.intellij.codeInsight.lookup.LookupElement
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import org.jetbrains.jet.lang.psi.JetFunction
|
import org.jetbrains.jet.lang.psi.JetFunction
|
||||||
import org.jetbrains.jet.lang.psi.JetPsiUtil
|
import org.jetbrains.jet.lang.psi.JetPsiUtil
|
||||||
@@ -54,7 +51,6 @@ public object KotlinKeywordInsertHandler : InsertHandler<LookupElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add space after keyword
|
// Add space after keyword
|
||||||
context.setAddCompletionChar(false)
|
WithTailInsertHandler.spaceTail().postHandleInsert(context, item)
|
||||||
TailType.SPACE.processTail(context.getEditor(), context.getTailOffset())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,5 +90,6 @@ class WithTailInsertHandler(val tailText: String,
|
|||||||
fun rparenthTail() = WithTailInsertHandler(")", spaceBefore = false, spaceAfter = false)
|
fun rparenthTail() = WithTailInsertHandler(")", spaceBefore = false, spaceAfter = false)
|
||||||
fun elseTail() = WithTailInsertHandler("else", spaceBefore = true, spaceAfter = true)
|
fun elseTail() = WithTailInsertHandler("else", spaceBefore = true, spaceAfter = true)
|
||||||
fun eqTail() = WithTailInsertHandler("=", spaceBefore = true, spaceAfter = true) /*TODO: use code style options*/
|
fun eqTail() = WithTailInsertHandler("=", spaceBefore = true, spaceAfter = true) /*TODO: use code style options*/
|
||||||
|
fun spaceTail() = WithTailInsertHandler(" ", spaceBefore = false, spaceAfter = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user