void () { boolean oldValue = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY; CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true; DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);// tests disable this by default ((CodeInsightTestFixtureImpl)myFixture).canChangeDocumentDuringHighlighting(true); try { configure(""" import java.util.ArrayList; import java.util.List; class Foo { public static void main(String[] args) { Class a = ArrayList.class; Class l = List.class; <caret> } }"""); assertTopLevelFoldRegionsState("[FoldRegion +(7:50), placeholder='...']"); myFixture.type("Class t = TreeMap.class;"); myFixture.doHighlighting();// let auto-import complete myFixture.checkResult(""" import java.util.ArrayList; import java.util.List; import java.util.TreeMap; class Foo { public static void main(String[] args) { Class a = ArrayList.class; Class l = List.class; Class t = TreeMap.class;<caret> } }"""); myFixture.doHighlighting();// update folding for the new text assertTopLevelFoldRegionsState("[FoldRegion +(7:76), placeholder='...']"); } finally { CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = oldValue; } }