From 93d9e780473bf1dbc6adef0663e5dc7ca6c35890 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Fri, 3 Apr 2015 11:30:07 +0300 Subject: [PATCH] Minor --- .../completion/handlers/KotlinCallableInsertHandler.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinCallableInsertHandler.kt b/idea/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinCallableInsertHandler.kt index c0d16cfa652..75998775b61 100644 --- a/idea/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinCallableInsertHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/completion/handlers/KotlinCallableInsertHandler.kt @@ -59,7 +59,7 @@ public abstract class KotlinCallableInsertHandler : BaseDeclarationInsertHandler private fun addImport(context : InsertionContext, item : LookupElement) { PsiDocumentManager.getInstance(context.getProject()).commitAllDocuments() - ApplicationManager.getApplication()?.runReadAction { () : Unit -> + ApplicationManager.getApplication()?.runReadAction { val startOffset = context.getStartOffset() val element = context.getFile().findElementAt(startOffset) @@ -156,8 +156,7 @@ public class KotlinFunctionInsertHandler(val caretPosition : CaretPosition, val if (offset < document.getTextLength()) { if (chars[offset] == '<') { PsiDocumentManager.getInstance(context.getProject()).commitDocument(document) - val psiFile = context.getFile() - val token = psiFile.findElementAt(offset) + val token = context.getFile().findElementAt(offset)!! if (token.getNode().getElementType() == JetTokens.LT) { val parent = token.getParent() if (parent is JetTypeArgumentList && parent.getText().indexOf('\n') < 0/* if type argument list is on multiple lines this is more likely wrong parsing*/) { @@ -221,10 +220,6 @@ public class KotlinFunctionInsertHandler(val caretPosition : CaretPosition, val public val NO_PARAMETERS_HANDLER: KotlinFunctionInsertHandler = KotlinFunctionInsertHandler(CaretPosition.AFTER_BRACKETS, null) public val WITH_PARAMETERS_HANDLER: KotlinFunctionInsertHandler = KotlinFunctionInsertHandler(CaretPosition.IN_BRACKETS, null) - private fun shouldAddBrackets(element : PsiElement) : Boolean { - return element.getStrictParentOfType() == null - } - private fun indexOfSkippingSpace(document: Document, ch : Char, startIndex : Int) : Int { val text = document.getCharsSequence() for (i in startIndex..text.length() - 1) {