diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 69340c2e5a4..8b3332277db 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -924,7 +924,7 @@ fun main(args: Array) { } testClass { - model("handlers/charFilter") + model("handlers/charFilter", pattern = KT_WITHOUT_DOTS_IN_NAME) } testClass { @@ -1219,7 +1219,7 @@ fun main(args: Array) { } testClass { - model("handlers/charFilter", testMethod = "doPerfTest") + model("handlers/charFilter", testMethod = "doPerfTest", pattern = KT_WITHOUT_DOTS_IN_NAME) } } /* diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PerModulePackageCacheService.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PerModulePackageCacheService.kt index 7f3a551738d..7b1ce1d29dc 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PerModulePackageCacheService.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PerModulePackageCacheService.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.idea.caches import com.intellij.ProjectTopics -import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.diagnostic.Logger @@ -87,7 +86,7 @@ class KotlinPackageContentModificationListener(private val project: Project) { class KotlinPackageStatementPsiTreeChangePreprocessor(private val project: Project) : PsiTreeChangePreprocessor { override fun treeChanged(event: PsiTreeChangeEventImpl) { val eFile = event.file ?: event.child as? PsiFile - if (eFile == null) LOG.debugIfEnabled(project, "Got PsiEvent: $event without file", true) + if (eFile == null) LOG.debugIfEnabled(project, true) { "Got PsiEvent: $event without file" } val file = eFile as? KtFile ?: return when (event.code) { @@ -96,7 +95,7 @@ class KotlinPackageStatementPsiTreeChangePreprocessor(private val project: Proje PsiTreeChangeEventImpl.PsiEventType.CHILD_REPLACED, PsiTreeChangeEventImpl.PsiEventType.CHILD_REMOVED -> { val child = event.child ?: run { - LOG.debugIfEnabled(project, "Got PsiEvent: $event without child", true) + LOG.debugIfEnabled(project, true) { "Got PsiEvent: $event without child" } return } if (child.getParentOfType(false) != null) @@ -104,10 +103,10 @@ class KotlinPackageStatementPsiTreeChangePreprocessor(private val project: Proje } PsiTreeChangeEventImpl.PsiEventType.CHILDREN_CHANGED -> { val parent = event.parent ?: run { - LOG.debugIfEnabled(project, "Got PsiEvent: $event without parent", true) + LOG.debugIfEnabled(project, true) { "Got PsiEvent: $event without parent" } return } - if (parent.getChildrenOfType().any()) + if (!event.isGenericChange && (parent.getChildrenOfType().any() || parent is KtPackageDirective)) ServiceManager.getService(project, PerModulePackageCacheService::class.java).notifyPackageChange(file) } else -> { @@ -244,7 +243,7 @@ class PerModulePackageCacheService(private val project: Project) { } private fun invalidateCacheForModuleSourceInfo(moduleSourceInfo: ModuleSourceInfo) { - LOG.debugIfEnabled(project, "Invalidated cache for $moduleSourceInfo", false) + LOG.debugIfEnabled(project) { "Invalidated cache for $moduleSourceInfo" } val perSourceInfoData = cache[moduleSourceInfo.module] ?: return val dataForSourceInfo = perSourceInfoData[moduleSourceInfo] ?: return dataForSourceInfo.clear() @@ -264,14 +263,14 @@ class PerModulePackageCacheService(private val project: Project) { if (sourceRootUrls.any { url -> vfile.containedInOrContains(url) }) { - LOG.debugIfEnabled(project, "Invalidated cache for $module") + LOG.debugIfEnabled(project) { "Invalidated cache for $module" } data.clear() } } } else { val infoByVirtualFile = getModuleInfoByVirtualFile(project, vfile) if (infoByVirtualFile == null || infoByVirtualFile !is ModuleSourceInfo) { - LOG.debugIfEnabled(project, "Skip $vfile as it has mismatched ModuleInfo=$infoByVirtualFile") + LOG.debugIfEnabled(project) { "Skip $vfile as it has mismatched ModuleInfo=$infoByVirtualFile" } } (infoByVirtualFile as? ModuleSourceInfo)?.let { invalidateCacheForModuleSourceInfo(it) @@ -283,13 +282,13 @@ class PerModulePackageCacheService(private val project: Project) { pendingKtFileChanges.processPending { file -> if (file.virtualFile != null && file.virtualFile !in projectScope) { - LOG.debugIfEnabled(project, "Skip $file without vFile, or not in scope: ${file.virtualFile?.let { it !in projectScope }}") + LOG.debugIfEnabled(project) { "Skip $file without vFile, or not in scope: ${file.virtualFile?.let { it !in projectScope }}" } return@processPending } val nullableModuleInfo = file.getNullableModuleInfo() (nullableModuleInfo as? ModuleSourceInfo)?.let { invalidateCacheForModuleSourceInfo(it) } if (nullableModuleInfo == null || nullableModuleInfo !is ModuleSourceInfo) { - LOG.debugIfEnabled(project, "Skip $file as it has mismatched ModuleInfo=$nullableModuleInfo") + LOG.debugIfEnabled(project) { "Skip $file as it has mismatched ModuleInfo=$nullableModuleInfo" } } implicitPackagePrefixCache.update(file) } @@ -329,7 +328,7 @@ class PerModulePackageCacheService(private val project: Project) { return cacheForCurrentModuleInfo.getOrPut(packageFqName) { val packageExists = PackageIndexUtil.packageExists(packageFqName, moduleInfo.contentScope(), project) - LOG.debugIfEnabled(project, "Computed cache value for $packageFqName in $moduleInfo is $packageExists") + LOG.debugIfEnabled(project) { "Computed cache value for $packageFqName in $moduleInfo is $packageExists" } packageExists } } @@ -351,16 +350,14 @@ class PerModulePackageCacheService(private val project: Project) { } } - - - -private fun Logger.debugIfEnabled(project: Project, message: String, withCurrentTrace: Boolean = false) { +private fun Logger.debugIfEnabled(project: Project, withCurrentTrace: Boolean = false, message: () -> String) { if (ApplicationManager.getApplication().isUnitTestMode && project.DEBUG_LOG_ENABLE_PerModulePackageCache) { + val msg = message() if (withCurrentTrace) { val e = Exception().apply { fillInStackTrace() } - this.debug(message, e) + this.debug(msg, e) } else { - this.debug(message) + this.debug(msg) } } } \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.dependency.kt b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.dependency.kt new file mode 100644 index 00000000000..1e1932b2d0f --- /dev/null +++ b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.dependency.kt @@ -0,0 +1,5 @@ +package org.jetbrains.annotations + +@Retention(AnnotationRetention.BINARY) +@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FIELD) +public annotation class PropertyKey(public val resourceBundle: String) \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.dependency.properties b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.dependency.properties new file mode 100644 index 00000000000..f39c9764aab --- /dev/null +++ b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.dependency.properties @@ -0,0 +1,3 @@ +foobar = 0 +foo.bar = 1 +bar.baz = 2 \ No newline at end of file diff --git a/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt new file mode 100644 index 00000000000..c1544247cc5 --- /dev/null +++ b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt @@ -0,0 +1,10 @@ +import org.jetbrains.annotations.PropertyKey + +fun message(@PropertyKey(resourceBundle = "MessageBundle1.dependency") key: String) = key + +fun test() { + message("") +} + +// ELEMENT: foo.bar +// CHARS: 'foo\n' diff --git a/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt.after b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt.after new file mode 100644 index 00000000000..e34be94fa14 --- /dev/null +++ b/idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt.after @@ -0,0 +1,10 @@ +import org.jetbrains.annotations.PropertyKey + +fun message(@PropertyKey(resourceBundle = "MessageBundle1.dependency") key: String) = key + +fun test() { + message("foo.bar") +} + +// ELEMENT: foo.bar +// CHARS: 'foo\n' diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractCompletionHandlerTests.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractCompletionHandlerTests.kt index 1bb1537f4cc..fe8085bcff1 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractCompletionHandlerTests.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/AbstractCompletionHandlerTests.kt @@ -24,6 +24,7 @@ abstract class AbstractCompletionHandlerTest(private val defaultCompletionType: private val ELEMENT_TEXT_PREFIX = "ELEMENT_TEXT:" private val TAIL_TEXT_PREFIX = "TAIL_TEXT:" private val COMPLETION_CHAR_PREFIX = "CHAR:" + private val COMPLETION_CHARS_PREFIX = "CHARS:" private val CODE_STYLE_SETTING_PREFIX = "CODE_STYLE_SETTING:" protected open fun doTest(testPath: String) { @@ -42,12 +43,10 @@ abstract class AbstractCompletionHandlerTest(private val defaultCompletionType: val itemText = InTextDirectivesUtils.findStringWithPrefixes(fileText, ELEMENT_TEXT_PREFIX) val tailText = InTextDirectivesUtils.findStringWithPrefixes(fileText, TAIL_TEXT_PREFIX) - val completionCharString = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHAR_PREFIX) - val completionChar = when(completionCharString) { - "\\n", null -> '\n' - "\\t" -> '\t' - else -> completionCharString.singleOrNull() ?: error("Incorrect completion char: \"$completionCharString\"") - } + val completionChars = completionChars( + char = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHAR_PREFIX), + chars = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHARS_PREFIX) + ) val completionType = ExpectedCompletionUtils.getCompletionType(fileText) ?: defaultCompletionType @@ -70,7 +69,15 @@ abstract class AbstractCompletionHandlerTest(private val defaultCompletionType: } } - doTestWithTextLoaded(completionType, invocationCount, lookupString, itemText, tailText, completionChar, File(testPath).name + ".after") + doTestWithTextLoaded( + completionType, + invocationCount, + lookupString, + itemText, + tailText, + completionChars, + File(testPath).name + ".after" + ) } finally { if (configured) { rollbackCompilerOptions(project, module) diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/BasicCompletionHandlerTest.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/BasicCompletionHandlerTest.kt index c414b3da6b4..c567777e0dd 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/BasicCompletionHandlerTest.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/BasicCompletionHandlerTest.kt @@ -31,7 +31,7 @@ class BasicCompletionHandlerTest : CompletionHandlerTestBase(){ private fun doTest(time: Int, lookupString: String?, itemText: String?, tailText: String?, completionChar: Char) { fixture.configureByFile(fileName()) - doTestWithTextLoaded(CompletionType.BASIC, time, lookupString, itemText, tailText, completionChar, fileName() + ".after") + doTestWithTextLoaded(CompletionType.BASIC, time, lookupString, itemText, tailText, completionChar.toString(), fileName() + ".after") } fun testClassCompletionImport() = doTest(2, "SortedSet", null, '\n') diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionCharFilterTestGenerated.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionCharFilterTestGenerated.java index 4bd16a471c2..7faecc08fe0 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionCharFilterTestGenerated.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionCharFilterTestGenerated.java @@ -26,7 +26,7 @@ public class CompletionCharFilterTestGenerated extends AbstractCompletionCharFil } public void testAllFilesPresentInCharFilter() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/charFilter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/charFilter"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true); } @TestMetadata("Colon.kt") @@ -144,6 +144,11 @@ public class CompletionCharFilterTestGenerated extends AbstractCompletionCharFil runTest("idea/idea-completion/testData/handlers/charFilter/LParenth.kt"); } + @TestMetadata("MessageBundle1.kt") + public void testMessageBundle1() throws Exception { + runTest("idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt"); + } + @TestMetadata("NamedParameter1.kt") public void testNamedParameter1() throws Exception { runTest("idea/idea-completion/testData/handlers/charFilter/NamedParameter1.kt"); diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionHandlerTestBase.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionHandlerTestBase.kt index 9d5bd8d75e7..386728b08ba 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionHandlerTestBase.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/CompletionHandlerTestBase.kt @@ -20,26 +20,40 @@ abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCa get() = myFixture protected fun doTestWithTextLoaded( - completionType: CompletionType, - time: Int, - lookupString: String?, - itemText: String?, - tailText: String?, - completionChar: Char, - afterFilePath: String + completionType: CompletionType, + time: Int, + lookupString: String?, + itemText: String?, + tailText: String?, + completionChars: String, + afterFilePath: String ) { + for (idx in 0 until completionChars.length - 1) { + fixture.type(completionChars[idx]) + } + fixture.complete(completionType, time) if (lookupString != null || itemText != null || tailText != null) { val item = getExistentLookupElement(lookupString, itemText, tailText) if (item != null) { - selectItem(item, completionChar) + selectItem(item, completionChars.last()) } } - fixture.checkResultByFile(afterFilePath) } + protected fun completionChars(char: String?, chars: String?): String = + when (char) { + null -> when (chars) { + null -> "\n" + else -> chars.replace("\\n", "\n").replace("\\t", "\t") + } + "\\n" -> "\n" + "\\t" -> "\t" + else -> char.single().toString() ?: error("Incorrect completion char: \"$char\"") + } + protected fun getExistentLookupElement(lookupString: String?, itemText: String?, tailText: String?): LookupElement? { val lookup = LookupManager.getInstance(project)?.activeLookup as LookupImpl? ?: return null val items = lookup.items diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ideaTestUtils.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ideaTestUtils.kt index b916a9729a2..110a060317d 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ideaTestUtils.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ideaTestUtils.kt @@ -14,7 +14,7 @@ fun CodeInsightTestFixture.configureWithExtraFile(path: String, vararg extraName val fileName = File(path).name val noExtensionPath = FileUtil.getNameWithoutExtension(fileName) - val extensions = arrayOf("kt", "java") + val extensions = arrayOf("kt", "java", "properties") val extraPaths: List = extraNameParts .flatMap { extensions.map { ext -> "$noExtensionPath$it.$ext" } } .mapNotNull { File(testDataPath, it).takeIf { it.exists() }?.name } diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceCompletionHandlerTests.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceCompletionHandlerTests.kt index 5b5d26127fa..ea0d1fd2b19 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceCompletionHandlerTests.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceCompletionHandlerTests.kt @@ -22,7 +22,7 @@ import org.junit.AfterClass import java.io.File /** - * inspired by @see AbstractCompletionHandlerTest + * inspired by @see AbstractCompletionHandlerTests */ abstract class AbstractPerformanceCompletionHandlerTests( private val defaultCompletionType: CompletionType, @@ -34,6 +34,7 @@ abstract class AbstractPerformanceCompletionHandlerTests( private val ELEMENT_TEXT_PREFIX = "ELEMENT_TEXT:" private val TAIL_TEXT_PREFIX = "TAIL_TEXT:" private val COMPLETION_CHAR_PREFIX = "CHAR:" + private val COMPLETION_CHARS_PREFIX = "CHARS:" private val CODE_STYLE_SETTING_PREFIX = "CODE_STYLE_SETTING:" companion object { @@ -74,12 +75,10 @@ abstract class AbstractPerformanceCompletionHandlerTests( val itemText = InTextDirectivesUtils.findStringWithPrefixes(fileText, ELEMENT_TEXT_PREFIX) val tailText = InTextDirectivesUtils.findStringWithPrefixes(fileText, TAIL_TEXT_PREFIX) - val completionCharString = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHAR_PREFIX) - val completionChar = when(completionCharString) { - "\\n", null -> '\n' - "\\t" -> '\t' - else -> completionCharString.singleOrNull() ?: error("Incorrect completion char: \"$completionCharString\"") - } + val completionChars = completionChars( + char = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHAR_PREFIX), + chars = InTextDirectivesUtils.findStringWithPrefixes(fileText, COMPLETION_CHARS_PREFIX) + ) val completionType = ExpectedCompletionUtils.getCompletionType(fileText) ?: defaultCompletionType @@ -102,7 +101,7 @@ abstract class AbstractPerformanceCompletionHandlerTests( } doPerfTestWithTextLoaded( - testPath, completionType, invocationCount, lookupString, itemText, tailText, completionChar + testPath, completionType, invocationCount, lookupString, itemText, tailText, completionChars ) } finally { if (configured) { @@ -120,7 +119,7 @@ abstract class AbstractPerformanceCompletionHandlerTests( lookupString: String?, itemText: String?, tailText: String?, - completionChar: Char + completionChars: String ) { val testName = getTestName(false) @@ -132,7 +131,7 @@ abstract class AbstractPerformanceCompletionHandlerTests( setUpFixture(testPath) }, test = { - perfTestCore(completionType, time, lookupString, itemText, tailText, completionChar) + perfTestCore(completionType, time, lookupString, itemText, tailText, completionChars) }, tearDown = { runWriteAction { @@ -147,14 +146,20 @@ abstract class AbstractPerformanceCompletionHandlerTests( lookupString: String?, itemText: String?, tailText: String?, - completionChar: Char + completionChars: String ) { + completionChars?.let { + for (idx in 0 until it.length - 1) { + fixture.type(it[idx]) + } + } + fixture.complete(completionType, time) if (lookupString != null || itemText != null || tailText != null) { val item = getExistentLookupElement(lookupString, itemText, tailText) if (item != null) { - selectItem(item, completionChar) + selectItem(item, completionChars.last()) } } } diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt index 3d312f8c2f7..16386a6049a 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt @@ -103,6 +103,16 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { } } + protected fun warmUpProject(stats: Stats) { + val project = innerPerfOpenProject("helloKotlin", stats, "warm-up") + try { + val perfHighlightFile = perfHighlightFile(project, "src/HelloMain.kt", stats, "warm-up") + assertTrue("kotlin project has been not imported properly", perfHighlightFile.isNotEmpty()) + } finally { + closeProject(project) + } + } + override fun tearDown() { RunAll( ThrowableRunnable { super.tearDown() }, @@ -122,6 +132,9 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { return if (lastIndexOf >= 0) fileName.substring(lastIndexOf + 1) else fileName } + protected fun perfOpenKotlinProject(stats: Stats) = + perfOpenProject("perfTestProject", stats = stats, path = "..") + protected fun perfOpenProject(name: String, stats: Stats, path: String = "idea/testData/perfTest") { myProject = innerPerfOpenProject(name, stats, path = path, note = "") } @@ -291,8 +304,8 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { stats: Stats, note: String = "" ): List { - var highlightInfos: List = emptyList() - IdentifierHighlighterPassFactory.doWithHighlightingEnabled { + return highlightFile { + var highlightInfos: List = emptyList() stats.perfTest>( testName = "highlighting ${if (note.isNotEmpty()) "$note " else ""}${simpleFilename(fileName)}", setUp = { @@ -309,9 +322,21 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { PsiManager.getInstance(project).dropPsiCaches() } ) + highlightInfos } - //println("${"-".repeat(40)}\n$fileName ->\n${highlightInfos.joinToString("\n")}\n") + } + fun highlightFile(psiFile: PsiFile): List { + return highlightFile { + highlightFile(myProject!!, psiFile) + } + } + + private fun highlightFile(block: () -> List): List { + var highlightInfos: List = emptyList() + IdentifierHighlighterPassFactory.doWithHighlightingEnabled { + highlightInfos = block() + } return highlightInfos } @@ -392,7 +417,7 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { } } - private fun openFileInEditor(project: Project, name: String): EditorFile { + fun openFileInEditor(project: Project, name: String): EditorFile { val fileDocumentManager = FileDocumentManager.getInstance() val fileEditorManager = FileEditorManager.getInstance(project) @@ -421,6 +446,6 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { return virtualFile!!.toPsiFile(project)!! } - private data class EditorFile(val psiFile: PsiFile, val document: Document) + data class EditorFile(val psiFile: PsiFile, val document: Document) } \ No newline at end of file diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceCompletionCharFilterTestGenerated.java b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceCompletionCharFilterTestGenerated.java index ef6f4f9e667..688f1c93344 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceCompletionCharFilterTestGenerated.java +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceCompletionCharFilterTestGenerated.java @@ -26,7 +26,7 @@ public class PerformanceCompletionCharFilterTestGenerated extends AbstractPerfor } public void testAllFilesPresentInCharFilter() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/charFilter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/idea-completion/testData/handlers/charFilter"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true); } @TestMetadata("Colon.kt") @@ -144,6 +144,11 @@ public class PerformanceCompletionCharFilterTestGenerated extends AbstractPerfor runTest("idea/idea-completion/testData/handlers/charFilter/LParenth.kt"); } + @TestMetadata("MessageBundle1.kt") + public void testMessageBundle1() throws Exception { + runTest("idea/idea-completion/testData/handlers/charFilter/MessageBundle1.kt"); + } + @TestMetadata("NamedParameter1.kt") public void testNamedParameter1() throws Exception { runTest("idea/idea-completion/testData/handlers/charFilter/NamedParameter1.kt"); diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceProjectsTest.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceProjectsTest.kt index b66144a00a6..16927021606 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceProjectsTest.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/PerformanceProjectsTest.kt @@ -35,10 +35,7 @@ class PerformanceProjectsTest : AbstractPerformanceProjectsTest() { super.setUp() // warm up: open simple small project if (!warmedUp) { - val project = innerPerfOpenProject("helloKotlin", hwStats, "warm-up") - val perfHighlightFile = perfHighlightFile(project, "src/HelloMain.kt", hwStats, "warm-up") - assertTrue("kotlin project has been not imported properly", perfHighlightFile.isNotEmpty()) - closeProject(project) + warmUpProject(hwStats) warmedUp = true } @@ -58,7 +55,7 @@ class PerformanceProjectsTest : AbstractPerformanceProjectsTest() { tcSuite("Kotlin project") { val stats = Stats("kotlin project") stats.use { - perfOpenProject("perfTestProject", stats = it, path = "..") + perfOpenKotlinProject(it) perfHighlightFile("compiler/psi/src/org/jetbrains/kotlin/psi/KtFile.kt", stats = it) @@ -71,7 +68,7 @@ class PerformanceProjectsTest : AbstractPerformanceProjectsTest() { tcSuite("Kotlin project highlight build gradle") { val stats = Stats("kotlin project highlight build gradle") stats.use { - perfOpenProject("perfTestProject", stats = it, path = "..") + perfOpenKotlinProject(it) enableAnnotatorsAndLoadDefinitions()