diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt index 607d7e1edeb..b2b6b6e1686 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt @@ -171,14 +171,12 @@ class BasicCompletionSession( val contextVariableTypesForSmartCompletion = withCollectRequiredContextVariableTypes(::completeWithSmartCompletion) - fun completeReferenceVariants(lookupElementFactory: LookupElementFactory) { + val contextVariableTypesForReferenceVariants = withCollectRequiredContextVariableTypes { lookupElementFactory -> val (imported, notImported) = referenceVariantsWithNonInitializedVarExcluded!! collector.addDescriptorElements(imported, lookupElementFactory) collector.addDescriptorElements(notImported, lookupElementFactory, notImported = true) } - val contextVariableTypesForReferenceVariants = withCollectRequiredContextVariableTypes(::completeReferenceVariants) - KEYWORDS_ONLY.doComplete() // getting root packages from scope is very slow so we do this in alternative way diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/handlerUtils.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/handlerUtils.kt index 3cb1950fdb9..62ad697f1fd 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/handlerUtils.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/handlerUtils.kt @@ -29,9 +29,10 @@ fun surroundWithBracesIfInStringTemplate(context: InsertionContext) { if (startOffset > 0 && document.charsSequence[startOffset - 1] == '$') { val psiDocumentManager = PsiDocumentManager.getInstance(context.project) psiDocumentManager.commitAllDocuments() - psiDocumentManager.doPostponedOperationsAndUnblockDocument(document) if (context.file.findElementAt(startOffset - 1)?.node?.elementType == KtTokens.SHORT_TEMPLATE_ENTRY_START) { + psiDocumentManager.doPostponedOperationsAndUnblockDocument(document) + document.insertString(startOffset, "{") context.offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, startOffset + 1)