From 6967028fdb33ef38ca04dcd52fa7395e70ad2b08 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 4 May 2018 15:02:56 +0300 Subject: [PATCH] KT-24146: Fix inserts imports automatically Even if "add unambiguous imports on the fly" is off #KT-24146 fixed --- .../jetbrains/kotlin/idea/quickfix/KotlinReferenceImporter.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinReferenceImporter.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinReferenceImporter.kt index 080652dea7f..d984d08b6d9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinReferenceImporter.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinReferenceImporter.kt @@ -47,6 +47,8 @@ class KotlinReferenceImporter : ReferenceImporter { val nameExpression = file.findElementAt(offset)?.parent as? KtSimpleNameExpression ?: return false + if (!CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY) return false + val importFix: ImportFixBase? = findImportFixAt(editor, file, offset) if (importFix != null && !importFix.isOutdated()) { val addImportAction = importFix.createAction(file.project, editor, nameExpression)