Minor changes on code review

This commit is contained in:
Valentin Kipyatkov
2015-11-03 11:45:31 +03:00
parent c11bf32594
commit bbea70a005
2 changed files with 3 additions and 4 deletions
@@ -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
@@ -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)