Switch to 202 platform
This commit is contained in:
Vendored
+4
-4
@@ -6,8 +6,8 @@ fun test() {
|
||||
message("<caret>")
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysEmptyString" }
|
||||
// NOTHING_ELSE
|
||||
+4
-4
@@ -6,8 +6,8 @@ fun test() {
|
||||
message("<caret>")
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysEmptyString" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysEmptyString" }
|
||||
// NOTHING_ELSE
|
||||
+4
-4
@@ -6,8 +6,8 @@ fun test() {
|
||||
message("<caret>foo")
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysNoPrefix" }
|
||||
// NOTHING_ELSE
|
||||
+4
-4
@@ -6,8 +6,8 @@ fun test() {
|
||||
message("<caret>foo")
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "=2", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysNoPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysNoPrefix" }
|
||||
// NOTHING_ELSE
|
||||
Vendored
+3
-3
@@ -6,7 +6,7 @@ fun test() {
|
||||
message("foo.<caret>")
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysWithPrefix" }
|
||||
// NOTHING_ELSE
|
||||
+3
-3
@@ -6,7 +6,7 @@ fun test() {
|
||||
message("foo.<caret>")
|
||||
}
|
||||
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "=1", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "=3", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "=4", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysWithPrefix" }
|
||||
// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysWithPrefix" }
|
||||
// NOTHING_ELSE
|
||||
@@ -23,11 +23,11 @@ class DaemonCodeAnalyzerStatusService(project: Project) : Disposable {
|
||||
init {
|
||||
val messageBusConnection = project.messageBus.connect(this)
|
||||
messageBusConnection.subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, object : DaemonCodeAnalyzer.DaemonListener {
|
||||
override fun daemonStarting(fileEditors: MutableCollection<FileEditor>) {
|
||||
override fun daemonStarting(fileEditors: MutableCollection<out FileEditor>) {
|
||||
daemonRunning = true
|
||||
}
|
||||
|
||||
override fun daemonFinished(fileEditors: MutableCollection<FileEditor>) {
|
||||
override fun daemonFinished(fileEditors: MutableCollection<out FileEditor>) {
|
||||
daemonRunning = false
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -23,11 +23,11 @@ class DaemonCodeAnalyzerStatusService(project: Project) : Disposable {
|
||||
init {
|
||||
val messageBusConnection = project.messageBus.connect(this)
|
||||
messageBusConnection.subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, object : DaemonCodeAnalyzer.DaemonListener {
|
||||
override fun daemonStarting(fileEditors: MutableCollection<out FileEditor>) {
|
||||
override fun daemonStarting(fileEditors: MutableCollection<FileEditor>) {
|
||||
daemonRunning = true
|
||||
}
|
||||
|
||||
override fun daemonFinished(fileEditors: MutableCollection<out FileEditor>) {
|
||||
override fun daemonFinished(fileEditors: MutableCollection<FileEditor>) {
|
||||
daemonRunning = false
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
||||
RevealFileAction.openDirectory(logsDir)
|
||||
} else {
|
||||
val parent = WindowManager.getInstance().getStatusBar(project)?.component
|
||||
?: WindowManager.getInstance().findVisibleFrame().rootPane
|
||||
?: WindowManager.getInstance().findVisibleFrame()?.rootPane
|
||||
JBPopupFactory.getInstance()
|
||||
.createHtmlTextBalloonBuilder(
|
||||
KotlinIdeaGradleBundle.message(
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware {
|
||||
RevealFileAction.openDirectory(logsDir)
|
||||
} else {
|
||||
val parent = WindowManager.getInstance().getStatusBar(project)?.component
|
||||
?: WindowManager.getInstance().findVisibleFrame()?.rootPane
|
||||
?: WindowManager.getInstance().findVisibleFrame().rootPane
|
||||
JBPopupFactory.getInstance()
|
||||
.createHtmlTextBalloonBuilder(
|
||||
KotlinIdeaGradleBundle.message(
|
||||
+2
-1
@@ -25,6 +25,7 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
@@ -49,7 +50,7 @@ public class PluginTestCaseBase {
|
||||
@NotNull
|
||||
@TestOnly
|
||||
private static Sdk createMockJdk(@NotNull String name, String path) {
|
||||
return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false);
|
||||
return IdeaTestUtil.createMockJdk(name, path, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-2
@@ -25,7 +25,6 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
@@ -50,7 +49,7 @@ public class PluginTestCaseBase {
|
||||
@NotNull
|
||||
@TestOnly
|
||||
private static Sdk createMockJdk(@NotNull String name, String path) {
|
||||
return IdeaTestUtil.createMockJdk(name, path, false);
|
||||
return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -5,11 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.test
|
||||
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.StartupManager
|
||||
|
||||
// FIX ME WHEN BUNCH 201 REMOVED
|
||||
fun runPostStartupActivitiesOnce(project: Project) {
|
||||
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically()
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -5,7 +5,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.test
|
||||
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.StartupManager
|
||||
|
||||
// FIX ME WHEN BUNCH 201 REMOVED
|
||||
fun runPostStartupActivitiesOnce(project: Project) {
|
||||
}
|
||||
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically()
|
||||
}
|
||||
+4
-3
@@ -63,9 +63,10 @@ class KotlinClassWithDelegatedPropertyRenderer : ClassRenderer() {
|
||||
): String? {
|
||||
val toStringRenderer = rendererSettings.toStringRenderer
|
||||
if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.canRunEvaluation) {
|
||||
if (toStringRenderer.isApplicable(descriptor.type)) {
|
||||
return toStringRenderer.calcLabel(descriptor, evaluationContext, listener)
|
||||
}
|
||||
val label = toStringRenderer.isApplicableAsync(descriptor.type).thenApply { applicable: Boolean ->
|
||||
if (applicable) toStringRenderer.calcLabel(descriptor, evaluationContext, listener) else null
|
||||
}.get()
|
||||
return label
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
+3
-4
@@ -63,10 +63,9 @@ class KotlinClassWithDelegatedPropertyRenderer : ClassRenderer() {
|
||||
): String? {
|
||||
val toStringRenderer = rendererSettings.toStringRenderer
|
||||
if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.canRunEvaluation) {
|
||||
val label = toStringRenderer.isApplicableAsync(descriptor.type).thenApply { applicable: Boolean ->
|
||||
if (applicable) toStringRenderer.calcLabel(descriptor, evaluationContext, listener) else null
|
||||
}.get()
|
||||
return label
|
||||
if (toStringRenderer.isApplicable(descriptor.type)) {
|
||||
return toStringRenderer.calcLabel(descriptor, evaluationContext, listener)
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
+4
-3
@@ -13,11 +13,13 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
|
||||
import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.ProjectRootManager
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.jetbrains.plugins.gradle.util.GradleLog
|
||||
import org.jetbrains.plugins.gradle.util.suggestGradleVersion
|
||||
import java.io.File
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
@@ -34,14 +36,13 @@ const val GRADLE_JDK_NAME = "Gradle JDK"
|
||||
*/
|
||||
private fun _importProject(projectPath: String, project: Project) {
|
||||
GradleLog.LOG.info("Import project at $projectPath")
|
||||
val projectSdk = ProjectRootManager.getInstance(project).projectSdk
|
||||
assertNotNull(projectSdk, "project SDK not found for ${project.name} at $projectPath")
|
||||
val gradleProjectSettings = GradleProjectSettings()
|
||||
val gradleVersion = suggestGradleVersion(project) ?: GradleVersion.current()
|
||||
|
||||
GradleSettings.getInstance(project).gradleVmOptions =
|
||||
"-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}"
|
||||
|
||||
setupGradleSettings(gradleProjectSettings, projectPath, project, projectSdk)
|
||||
setupGradleSettings(project, gradleProjectSettings, projectPath, gradleVersion)
|
||||
gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME
|
||||
|
||||
GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings ->
|
||||
|
||||
+3
-4
@@ -13,13 +13,11 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
|
||||
import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.ProjectRootManager
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.jetbrains.plugins.gradle.util.GradleLog
|
||||
import org.jetbrains.plugins.gradle.util.suggestGradleVersion
|
||||
import java.io.File
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
@@ -36,13 +34,14 @@ const val GRADLE_JDK_NAME = "Gradle JDK"
|
||||
*/
|
||||
private fun _importProject(projectPath: String, project: Project) {
|
||||
GradleLog.LOG.info("Import project at $projectPath")
|
||||
val projectSdk = ProjectRootManager.getInstance(project).projectSdk
|
||||
assertNotNull(projectSdk, "project SDK not found for ${project.name} at $projectPath")
|
||||
val gradleProjectSettings = GradleProjectSettings()
|
||||
val gradleVersion = suggestGradleVersion(project) ?: GradleVersion.current()
|
||||
|
||||
GradleSettings.getInstance(project).gradleVmOptions =
|
||||
"-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}"
|
||||
|
||||
setupGradleSettings(project, gradleProjectSettings, projectPath, gradleVersion)
|
||||
setupGradleSettings(gradleProjectSettings, projectPath, project, projectSdk)
|
||||
gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME
|
||||
|
||||
GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings ->
|
||||
+4
-7
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.testFramework
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
|
||||
import com.intellij.ide.impl.OpenProjectTask
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl
|
||||
import com.intellij.lang.LanguageAnnotators
|
||||
import com.intellij.lang.LanguageExtensionPoint
|
||||
@@ -20,6 +21,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx
|
||||
import com.intellij.openapi.startup.StartupManager
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.impl.PsiDocumentManagerBase
|
||||
import com.intellij.testFramework.ExtensionTestUtil
|
||||
@@ -27,7 +29,6 @@ import com.intellij.testFramework.TestApplicationManager
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.kotlin.idea.perf.util.logMessage
|
||||
import org.jetbrains.kotlin.idea.test.runPostStartupActivitiesOnce
|
||||
import java.nio.file.Paths
|
||||
|
||||
fun commitAllDocuments() {
|
||||
@@ -69,7 +70,7 @@ fun dispatchAllInvocationEvents() {
|
||||
}
|
||||
|
||||
fun loadProjectWithName(path: String, name: String): Project? =
|
||||
ProjectManagerEx.getInstanceEx().loadProject(Paths.get(path), name)
|
||||
PlatformProjectOpenProcessor.openExistingProject(Paths.get(path), Paths.get(path), OpenProjectTask(projectName = name))
|
||||
|
||||
fun TestApplicationManager.closeProject(project: Project) {
|
||||
val name = project.name
|
||||
@@ -90,11 +91,7 @@ fun TestApplicationManager.closeProject(project: Project) {
|
||||
}
|
||||
|
||||
fun runStartupActivities(project: Project) {
|
||||
with(StartupManager.getInstance(project) as StartupManagerImpl) {
|
||||
//scheduleInitialVfsRefresh()
|
||||
runStartupActivities()
|
||||
}
|
||||
runPostStartupActivitiesOnce(project)
|
||||
// obsolete
|
||||
}
|
||||
|
||||
fun waitForAllEditorsFinallyLoaded(project: Project) {
|
||||
|
||||
+7
-4
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.idea.testFramework
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
|
||||
import com.intellij.ide.impl.OpenProjectTask
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl
|
||||
import com.intellij.lang.LanguageAnnotators
|
||||
import com.intellij.lang.LanguageExtensionPoint
|
||||
@@ -21,7 +20,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx
|
||||
import com.intellij.openapi.startup.StartupManager
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.impl.PsiDocumentManagerBase
|
||||
import com.intellij.testFramework.ExtensionTestUtil
|
||||
@@ -29,6 +27,7 @@ import com.intellij.testFramework.TestApplicationManager
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.kotlin.idea.perf.util.logMessage
|
||||
import org.jetbrains.kotlin.idea.test.runPostStartupActivitiesOnce
|
||||
import java.nio.file.Paths
|
||||
|
||||
fun commitAllDocuments() {
|
||||
@@ -70,7 +69,7 @@ fun dispatchAllInvocationEvents() {
|
||||
}
|
||||
|
||||
fun loadProjectWithName(path: String, name: String): Project? =
|
||||
PlatformProjectOpenProcessor.openExistingProject(Paths.get(path), Paths.get(path), OpenProjectTask(projectName = name))
|
||||
ProjectManagerEx.getInstanceEx().loadProject(Paths.get(path), name)
|
||||
|
||||
fun TestApplicationManager.closeProject(project: Project) {
|
||||
val name = project.name
|
||||
@@ -91,7 +90,11 @@ fun TestApplicationManager.closeProject(project: Project) {
|
||||
}
|
||||
|
||||
fun runStartupActivities(project: Project) {
|
||||
// obsolete
|
||||
with(StartupManager.getInstance(project) as StartupManagerImpl) {
|
||||
//scheduleInitialVfsRefresh()
|
||||
runStartupActivities()
|
||||
}
|
||||
runPostStartupActivitiesOnce(project)
|
||||
}
|
||||
|
||||
fun waitForAllEditorsFinallyLoaded(project: Project) {
|
||||
@@ -13,7 +13,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<version>@snapshot@</version>
|
||||
<vendor url="http://www.jetbrains.com">JetBrains</vendor>
|
||||
|
||||
<idea-version since-build="201.7223.91" until-build="201.*"/>
|
||||
<idea-version since-build="202.1" until-build="202.*"/>
|
||||
|
||||
<change-notes><![CDATA[
|
||||
<h3>1.4.20</h3>
|
||||
@@ -69,7 +69,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->
|
||||
|
||||
<!-- CIDR-PLUGIN-PLACEHOLDER-START -->
|
||||
<depends>com.intellij.modules.idea</depends>
|
||||
<incompatible-with>com.intellij.modules.androidstudio</incompatible-with>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<depends optional="true" config-file="javaScriptDebug.xml">JavaScriptDebugger</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
@@ -110,7 +110,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<pathMacroContributor implementation="org.jetbrains.kotlin.idea.KotlinPluginMacros"/>
|
||||
<applicationService serviceImplementation="org.jetbrains.kotlin.idea.PluginStartupApplicationService"/>
|
||||
<applicationService serviceImplementation="org.jetbrains.kotlin.idea.PluginStartupApplicationService" />
|
||||
|
||||
<postStartupActivity implementation="org.jetbrains.kotlin.idea.PluginStartupActivity"/>
|
||||
<projectService serviceImplementation="org.jetbrains.kotlin.idea.PluginStartupService"/>
|
||||
@@ -145,14 +145,11 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.formatter.KotlinFormatterUsageCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.statistics.ProjectConfigurationCollector"/>
|
||||
|
||||
<fileTypeUsageSchemaDescriptor schema="Gradle Script"
|
||||
implementationClass="org.jetbrains.kotlin.idea.core.script.KotlinGradleScriptFileTypeSchemaDetector"/>
|
||||
<fileTypeUsageSchemaDescriptor schema="Gradle Script" implementationClass="org.jetbrains.kotlin.idea.core.script.KotlinGradleScriptFileTypeSchemaDetector"/>
|
||||
|
||||
<completion.ml.model implementation="org.jetbrains.kotlin.idea.completion.ml.KotlinMLRankingProvider"/>
|
||||
<completion.ml.contextFeatures language="kotlin"
|
||||
implementationClass="org.jetbrains.kotlin.idea.completion.ml.KotlinContextFeatureProvider"/>
|
||||
<suggestedRefactoringSupport language="kotlin"
|
||||
implementationClass="org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringSupport"/>
|
||||
<completion.ml.contextFeatures language="kotlin" implementationClass="org.jetbrains.kotlin.idea.completion.ml.KotlinContextFeatureProvider"/>
|
||||
<suggestedRefactoringSupport language="kotlin" implementationClass="org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringSupport"/>
|
||||
|
||||
<refactoring.moveInnerHandler language="kotlin"
|
||||
implementationClass="org.jetbrains.kotlin.idea.refactoring.move.MoveKotlinInnerHandler"/>
|
||||
|
||||
+9
-6
@@ -13,7 +13,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<version>@snapshot@</version>
|
||||
<vendor url="http://www.jetbrains.com">JetBrains</vendor>
|
||||
|
||||
<idea-version since-build="202.1" until-build="202.*"/>
|
||||
<idea-version since-build="201.7223.91" until-build="201.*"/>
|
||||
|
||||
<change-notes><![CDATA[
|
||||
<h3>1.4.20</h3>
|
||||
@@ -69,7 +69,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->
|
||||
|
||||
<!-- CIDR-PLUGIN-PLACEHOLDER-START -->
|
||||
<incompatible-with>com.intellij.modules.androidstudio</incompatible-with>
|
||||
<depends>com.intellij.modules.idea</depends>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<depends optional="true" config-file="javaScriptDebug.xml">JavaScriptDebugger</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
@@ -110,7 +110,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<pathMacroContributor implementation="org.jetbrains.kotlin.idea.KotlinPluginMacros"/>
|
||||
<applicationService serviceImplementation="org.jetbrains.kotlin.idea.PluginStartupApplicationService" />
|
||||
<applicationService serviceImplementation="org.jetbrains.kotlin.idea.PluginStartupApplicationService"/>
|
||||
|
||||
<postStartupActivity implementation="org.jetbrains.kotlin.idea.PluginStartupActivity"/>
|
||||
<projectService serviceImplementation="org.jetbrains.kotlin.idea.PluginStartupService"/>
|
||||
@@ -145,11 +145,14 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.formatter.KotlinFormatterUsageCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.statistics.ProjectConfigurationCollector"/>
|
||||
|
||||
<fileTypeUsageSchemaDescriptor schema="Gradle Script" implementationClass="org.jetbrains.kotlin.idea.core.script.KotlinGradleScriptFileTypeSchemaDetector"/>
|
||||
<fileTypeUsageSchemaDescriptor schema="Gradle Script"
|
||||
implementationClass="org.jetbrains.kotlin.idea.core.script.KotlinGradleScriptFileTypeSchemaDetector"/>
|
||||
|
||||
<completion.ml.model implementation="org.jetbrains.kotlin.idea.completion.ml.KotlinMLRankingProvider"/>
|
||||
<completion.ml.contextFeatures language="kotlin" implementationClass="org.jetbrains.kotlin.idea.completion.ml.KotlinContextFeatureProvider"/>
|
||||
<suggestedRefactoringSupport language="kotlin" implementationClass="org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringSupport"/>
|
||||
<completion.ml.contextFeatures language="kotlin"
|
||||
implementationClass="org.jetbrains.kotlin.idea.completion.ml.KotlinContextFeatureProvider"/>
|
||||
<suggestedRefactoringSupport language="kotlin"
|
||||
implementationClass="org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringSupport"/>
|
||||
|
||||
<refactoring.moveInnerHandler language="kotlin"
|
||||
implementationClass="org.jetbrains.kotlin.idea.refactoring.move.MoveKotlinInnerHandler"/>
|
||||
+2
-2
@@ -46,7 +46,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() {
|
||||
val project = myFixture.project
|
||||
val document = myFixture.editor.document
|
||||
|
||||
val data = ExpectedHighlightingData(document, false, false, false, myFixture.file)
|
||||
val data = ExpectedHighlightingData(document, false, false, false)
|
||||
data.init()
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
@@ -69,7 +69,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() {
|
||||
): List<LineMarkerInfo<*>> {
|
||||
myFixture.doHighlighting()
|
||||
|
||||
return AbstractLineMarkersTest.checkHighlighting(myFixture.project, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -46,7 +46,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() {
|
||||
val project = myFixture.project
|
||||
val document = myFixture.editor.document
|
||||
|
||||
val data = ExpectedHighlightingData(document, false, false, false)
|
||||
val data = ExpectedHighlightingData(document, false, false, false, myFixture.file)
|
||||
data.init()
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
@@ -69,7 +69,7 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() {
|
||||
): List<LineMarkerInfo<*>> {
|
||||
myFixture.doHighlighting()
|
||||
|
||||
return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
return AbstractLineMarkersTest.checkHighlighting(myFixture.project, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -78,11 +78,11 @@ class KotlinHighlightExitPointsHandlerFactory : HighlightUsagesHandlerFactoryBas
|
||||
|
||||
override fun getTargets() = listOf(target)
|
||||
|
||||
override fun selectTargets(targets: MutableList<PsiElement>, selectionConsumer: Consumer<MutableList<PsiElement>>) {
|
||||
override fun selectTargets(targets: MutableList<out PsiElement>, selectionConsumer: Consumer<in MutableList<out PsiElement>>) {
|
||||
selectionConsumer.consume(targets)
|
||||
}
|
||||
|
||||
override fun computeUsages(targets: MutableList<PsiElement>?) {
|
||||
override fun computeUsages(targets: MutableList<out PsiElement>) {
|
||||
val relevantFunction: KtDeclarationWithBody? =
|
||||
if (target is KtFunctionLiteral) {
|
||||
target
|
||||
|
||||
+2
-2
@@ -78,11 +78,11 @@ class KotlinHighlightExitPointsHandlerFactory : HighlightUsagesHandlerFactoryBas
|
||||
|
||||
override fun getTargets() = listOf(target)
|
||||
|
||||
override fun selectTargets(targets: MutableList<out PsiElement>, selectionConsumer: Consumer<in MutableList<out PsiElement>>) {
|
||||
override fun selectTargets(targets: MutableList<PsiElement>, selectionConsumer: Consumer<MutableList<PsiElement>>) {
|
||||
selectionConsumer.consume(targets)
|
||||
}
|
||||
|
||||
override fun computeUsages(targets: MutableList<out PsiElement>) {
|
||||
override fun computeUsages(targets: MutableList<PsiElement>?) {
|
||||
val relevantFunction: KtDeclarationWithBody? =
|
||||
if (target is KtFunctionLiteral) {
|
||||
target
|
||||
+3
-3
@@ -38,11 +38,11 @@ class KotlinHighlightImplicitItHandlerFactory : HighlightUsagesHandlerFactoryBas
|
||||
override fun getTargets() = listOf(refExpr)
|
||||
|
||||
override fun selectTargets(
|
||||
targets: MutableList<KtNameReferenceExpression>,
|
||||
selectionConsumer: Consumer<MutableList<KtNameReferenceExpression>>
|
||||
targets: MutableList<out KtNameReferenceExpression>,
|
||||
selectionConsumer: Consumer<in MutableList<out KtNameReferenceExpression>>
|
||||
) = selectionConsumer.consume(targets)
|
||||
|
||||
override fun computeUsages(targets: MutableList<KtNameReferenceExpression>?) {
|
||||
override fun computeUsages(targets: MutableList<out KtNameReferenceExpression>) {
|
||||
lambda.accept(
|
||||
object : KtTreeVisitorVoid() {
|
||||
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) {
|
||||
|
||||
+3
-3
@@ -38,11 +38,11 @@ class KotlinHighlightImplicitItHandlerFactory : HighlightUsagesHandlerFactoryBas
|
||||
override fun getTargets() = listOf(refExpr)
|
||||
|
||||
override fun selectTargets(
|
||||
targets: MutableList<out KtNameReferenceExpression>,
|
||||
selectionConsumer: Consumer<in MutableList<out KtNameReferenceExpression>>
|
||||
targets: MutableList<KtNameReferenceExpression>,
|
||||
selectionConsumer: Consumer<MutableList<KtNameReferenceExpression>>
|
||||
) = selectionConsumer.consume(targets)
|
||||
|
||||
override fun computeUsages(targets: MutableList<out KtNameReferenceExpression>) {
|
||||
override fun computeUsages(targets: MutableList<KtNameReferenceExpression>?) {
|
||||
lambda.accept(
|
||||
object : KtTreeVisitorVoid() {
|
||||
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) {
|
||||
+1
-1
@@ -46,7 +46,7 @@ import java.util.*
|
||||
class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider {
|
||||
override fun getLineMarkerInfo(element: PsiElement) = null
|
||||
|
||||
override fun collectSlowLineMarkers(elements: MutableList<PsiElement>, result: LineMarkerInfos) {
|
||||
override fun collectSlowLineMarkers(elements: MutableList<out PsiElement>, result: LineMarkerInfos) {
|
||||
val markedLineNumbers = HashSet<Int>()
|
||||
|
||||
for (element in elements) {
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ import java.util.*
|
||||
class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider {
|
||||
override fun getLineMarkerInfo(element: PsiElement) = null
|
||||
|
||||
override fun collectSlowLineMarkers(elements: MutableList<out PsiElement>, result: LineMarkerInfos) {
|
||||
override fun collectSlowLineMarkers(elements: MutableList<PsiElement>, result: LineMarkerInfos) {
|
||||
val markedLineNumbers = HashSet<Int>()
|
||||
|
||||
for (element in elements) {
|
||||
+1
-1
@@ -48,7 +48,7 @@ class KotlinSuspendCallLineMarkerProvider : LineMarkerProvider {
|
||||
override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? = null
|
||||
|
||||
override fun collectSlowLineMarkers(
|
||||
elements: MutableList<PsiElement>,
|
||||
elements: MutableList<out PsiElement>,
|
||||
result: LineMarkerInfos
|
||||
) {
|
||||
val markedLineNumbers = HashSet<Int>()
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ class KotlinSuspendCallLineMarkerProvider : LineMarkerProvider {
|
||||
override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? = null
|
||||
|
||||
override fun collectSlowLineMarkers(
|
||||
elements: MutableList<out PsiElement>,
|
||||
elements: MutableList<PsiElement>,
|
||||
result: LineMarkerInfos
|
||||
) {
|
||||
val markedLineNumbers = HashSet<Int>()
|
||||
@@ -7,4 +7,4 @@ package org.jetbrains.kotlin.idea.highlighter.markers
|
||||
|
||||
import com.intellij.codeInsight.daemon.LineMarkerInfo
|
||||
|
||||
typealias LineMarkerInfos = MutableCollection<LineMarkerInfo<*>>
|
||||
typealias LineMarkerInfos = MutableCollection<in LineMarkerInfo<*>>
|
||||
+1
-1
@@ -7,4 +7,4 @@ package org.jetbrains.kotlin.idea.highlighter.markers
|
||||
|
||||
import com.intellij.codeInsight.daemon.LineMarkerInfo
|
||||
|
||||
typealias LineMarkerInfos = MutableCollection<in LineMarkerInfo<*>>
|
||||
typealias LineMarkerInfos = MutableCollection<LineMarkerInfo<*>>
|
||||
@@ -161,9 +161,9 @@ class TrailingCommaInspection(
|
||||
val settings = CodeStyle.getSettings(project).clone()
|
||||
settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA = true
|
||||
settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA_ON_CALL_SITE = true
|
||||
CodeStyle.doWithTemporarySettings(project, settings) {
|
||||
CodeStyle.doWithTemporarySettings(project, settings, Runnable {
|
||||
CodeStyleManager.getInstance(project).reformatRange(element, range.startOffset, range.endOffset)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -161,9 +161,9 @@ class TrailingCommaInspection(
|
||||
val settings = CodeStyle.getSettings(project).clone()
|
||||
settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA = true
|
||||
settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA_ON_CALL_SITE = true
|
||||
CodeStyle.doWithTemporarySettings(project, settings, Runnable {
|
||||
CodeStyle.doWithTemporarySettings(project, settings) {
|
||||
CodeStyleManager.getInstance(project).reformatRange(element, range.startOffset, range.endOffset)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtil
|
||||
return null
|
||||
}
|
||||
|
||||
override fun isIdentifierPart(file: PsiFile, text: CharSequence?, offset: Int): Boolean {
|
||||
override fun isIdentifierPart(file: PsiFile, text: CharSequence, offset: Int): Boolean {
|
||||
val elementAtCaret = file.findElementAt(offset)
|
||||
|
||||
if (elementAtCaret?.node?.elementType == KtTokens.IDENTIFIER) return true
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtil
|
||||
return null
|
||||
}
|
||||
|
||||
override fun isIdentifierPart(file: PsiFile, text: CharSequence, offset: Int): Boolean {
|
||||
override fun isIdentifierPart(file: PsiFile, text: CharSequence?, offset: Int): Boolean {
|
||||
val elementAtCaret = file.findElementAt(offset)
|
||||
|
||||
if (elementAtCaret?.node?.elementType == KtTokens.IDENTIFIER) return true
|
||||
@@ -73,7 +73,7 @@ class KotlinSliceProvider : SliceLanguageSupportProvider, SliceUsageTransformer
|
||||
|
||||
override fun transform(usage: SliceUsage): Collection<SliceUsage>? {
|
||||
if (usage is KotlinSliceUsage) return null
|
||||
return listOf(KotlinSliceUsage(usage.element, usage.parent, KotlinSliceAnalysisMode.Default, false))
|
||||
return listOf(KotlinSliceUsage(usage.element ?: return null, usage.parent, KotlinSliceAnalysisMode.Default, false))
|
||||
}
|
||||
|
||||
override fun getExpressionAtCaret(atCaret: PsiElement, dataFlowToThis: Boolean): KtElement? {
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ class KotlinSliceProvider : SliceLanguageSupportProvider, SliceUsageTransformer
|
||||
|
||||
override fun transform(usage: SliceUsage): Collection<SliceUsage>? {
|
||||
if (usage is KotlinSliceUsage) return null
|
||||
return listOf(KotlinSliceUsage(usage.element ?: return null, usage.parent, KotlinSliceAnalysisMode.Default, false))
|
||||
return listOf(KotlinSliceUsage(usage.element, usage.parent, KotlinSliceAnalysisMode.Default, false))
|
||||
}
|
||||
|
||||
override fun getExpressionAtCaret(atCaret: PsiElement, dataFlowToThis: Boolean): KtElement? {
|
||||
@@ -12,6 +12,7 @@ import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.rt.execution.junit.FileComparisonFailure
|
||||
import com.intellij.testFramework.ExpectedHighlightingData
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
@@ -40,14 +41,14 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
fun doTest(path: String) = doTest(path) {}
|
||||
|
||||
protected fun doAndCheckHighlighting(
|
||||
project: Project,
|
||||
psiFile: PsiFile,
|
||||
documentToAnalyze: Document,
|
||||
expectedHighlighting: ExpectedHighlightingData,
|
||||
expectedFile: File
|
||||
): List<LineMarkerInfo<*>> {
|
||||
myFixture.doHighlighting()
|
||||
|
||||
return checkHighlighting(project, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
return checkHighlighting(psiFile, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
}
|
||||
|
||||
fun doTest(path: String, additionalCheck: () -> Unit) {
|
||||
@@ -62,12 +63,12 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
val project = myFixture.project
|
||||
val document = myFixture.editor.document
|
||||
|
||||
val data = ExpectedHighlightingData(document, false, false, false, myFixture.file)
|
||||
val data = ExpectedHighlightingData(document, false, false, false)
|
||||
data.init()
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
|
||||
val markers = doAndCheckHighlighting(myFixture.project, document, data, testDataFile())
|
||||
val markers = doAndCheckHighlighting(myFixture.file, document, data, testDataFile())
|
||||
|
||||
assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers)
|
||||
additionalCheck()
|
||||
@@ -150,15 +151,15 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
}
|
||||
|
||||
fun checkHighlighting(
|
||||
project: Project,
|
||||
psiFile: PsiFile,
|
||||
documentToAnalyze: Document,
|
||||
expectedHighlighting: ExpectedHighlightingData,
|
||||
expectedFile: File
|
||||
): MutableList<LineMarkerInfo<*>> {
|
||||
val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, project)
|
||||
val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, psiFile.project)
|
||||
|
||||
try {
|
||||
expectedHighlighting.checkLineMarkers(markers, documentToAnalyze.text)
|
||||
expectedHighlighting.checkLineMarkers(psiFile, markers, documentToAnalyze.text)
|
||||
|
||||
// This is a workaround for sad bug in ExpectedHighlightingData:
|
||||
// the latter doesn't throw assertion error when some line markers are expected, but none are present.
|
||||
|
||||
+7
-8
@@ -12,7 +12,6 @@ import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.rt.execution.junit.FileComparisonFailure
|
||||
import com.intellij.testFramework.ExpectedHighlightingData
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
@@ -41,14 +40,14 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
fun doTest(path: String) = doTest(path) {}
|
||||
|
||||
protected fun doAndCheckHighlighting(
|
||||
psiFile: PsiFile,
|
||||
project: Project,
|
||||
documentToAnalyze: Document,
|
||||
expectedHighlighting: ExpectedHighlightingData,
|
||||
expectedFile: File
|
||||
): List<LineMarkerInfo<*>> {
|
||||
myFixture.doHighlighting()
|
||||
|
||||
return checkHighlighting(psiFile, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
return checkHighlighting(project, documentToAnalyze, expectedHighlighting, expectedFile)
|
||||
}
|
||||
|
||||
fun doTest(path: String, additionalCheck: () -> Unit) {
|
||||
@@ -63,12 +62,12 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
val project = myFixture.project
|
||||
val document = myFixture.editor.document
|
||||
|
||||
val data = ExpectedHighlightingData(document, false, false, false)
|
||||
val data = ExpectedHighlightingData(document, false, false, false, myFixture.file)
|
||||
data.init()
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
|
||||
val markers = doAndCheckHighlighting(myFixture.file, document, data, testDataFile())
|
||||
val markers = doAndCheckHighlighting(myFixture.project, document, data, testDataFile())
|
||||
|
||||
assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers)
|
||||
additionalCheck()
|
||||
@@ -151,15 +150,15 @@ abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
}
|
||||
|
||||
fun checkHighlighting(
|
||||
psiFile: PsiFile,
|
||||
project: Project,
|
||||
documentToAnalyze: Document,
|
||||
expectedHighlighting: ExpectedHighlightingData,
|
||||
expectedFile: File
|
||||
): MutableList<LineMarkerInfo<*>> {
|
||||
val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, psiFile.project)
|
||||
val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, project)
|
||||
|
||||
try {
|
||||
expectedHighlighting.checkLineMarkers(psiFile, markers, documentToAnalyze.text)
|
||||
expectedHighlighting.checkLineMarkers(markers, documentToAnalyze.text)
|
||||
|
||||
// This is a workaround for sad bug in ExpectedHighlightingData:
|
||||
// the latter doesn't throw assertion error when some line markers are expected, but none are present.
|
||||
+2
-4
@@ -65,9 +65,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest
|
||||
val project = myFixture.project
|
||||
for (file in libraryOriginal.walkTopDown().filter { !it.isDirectory }) {
|
||||
myFixture.openFileInEditor(fileSystem.findFileByPath(file.absolutePath)!!)
|
||||
val data = ExpectedHighlightingData(
|
||||
myFixture.editor.document, false, false, false, myFixture.file
|
||||
)
|
||||
val data = ExpectedHighlightingData(myFixture.editor.document, false, false, false)
|
||||
data.init()
|
||||
|
||||
val librarySourceFile = libraryClean!!.resolve(file.relativeTo(libraryOriginal).path)
|
||||
@@ -79,7 +77,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest
|
||||
throw AssertionError("File ${myFixture.file.virtualFile.path} should be in library sources!")
|
||||
}
|
||||
|
||||
doAndCheckHighlighting(myFixture.project, document, data, file)
|
||||
doAndCheckHighlighting(myFixture.file, document, data, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -65,7 +65,9 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest
|
||||
val project = myFixture.project
|
||||
for (file in libraryOriginal.walkTopDown().filter { !it.isDirectory }) {
|
||||
myFixture.openFileInEditor(fileSystem.findFileByPath(file.absolutePath)!!)
|
||||
val data = ExpectedHighlightingData(myFixture.editor.document, false, false, false)
|
||||
val data = ExpectedHighlightingData(
|
||||
myFixture.editor.document, false, false, false, myFixture.file
|
||||
)
|
||||
data.init()
|
||||
|
||||
val librarySourceFile = libraryClean!!.resolve(file.relativeTo(libraryOriginal).path)
|
||||
@@ -77,7 +79,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest
|
||||
throw AssertionError("File ${myFixture.file.virtualFile.path} should be in library sources!")
|
||||
}
|
||||
|
||||
doAndCheckHighlighting(myFixture.file, document, data, file)
|
||||
doAndCheckHighlighting(myFixture.project, document, data, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest
|
||||
protected fun doTest(unused: String) {
|
||||
myFixture.configureByFile(fileName())
|
||||
val document = myFixture.editor.document
|
||||
val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file)
|
||||
val data = ExpectedHighlightingData(document, false, false, true, false)
|
||||
data.init()
|
||||
|
||||
val caret = document.extractMarkerOffset(project, CARET_TAG)
|
||||
@@ -48,7 +48,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest
|
||||
.create()
|
||||
}
|
||||
|
||||
data.checkResult(infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString())
|
||||
data.checkResult(myFixture.file, infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString())
|
||||
}
|
||||
|
||||
private fun isUsageHighlighting(info: RangeHighlighter): Boolean {
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest
|
||||
protected fun doTest(unused: String) {
|
||||
myFixture.configureByFile(fileName())
|
||||
val document = myFixture.editor.document
|
||||
val data = ExpectedHighlightingData(document, false, false, true, false)
|
||||
val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file)
|
||||
data.init()
|
||||
|
||||
val caret = document.extractMarkerOffset(project, CARET_TAG)
|
||||
@@ -48,7 +48,7 @@ abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTest
|
||||
.create()
|
||||
}
|
||||
|
||||
data.checkResult(myFixture.file, infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString())
|
||||
data.checkResult(infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString())
|
||||
}
|
||||
|
||||
private fun isUsageHighlighting(info: RangeHighlighter): Boolean {
|
||||
@@ -53,7 +53,7 @@ class InspectionDescriptionTest : LightPlatformTestCase() {
|
||||
private fun loadKotlinInspections(): List<InspectionToolWrapper<InspectionProfileEntry, InspectionEP>> {
|
||||
return InspectionToolRegistrar.getInstance().createTools().filter {
|
||||
it.extension.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID
|
||||
}
|
||||
} as List<InspectionToolWrapper<InspectionProfileEntry, InspectionEP>>
|
||||
}
|
||||
|
||||
private fun loadKotlinInspectionExtensions() =
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class InspectionDescriptionTest : LightPlatformTestCase() {
|
||||
private fun loadKotlinInspections(): List<InspectionToolWrapper<InspectionProfileEntry, InspectionEP>> {
|
||||
return InspectionToolRegistrar.getInstance().createTools().filter {
|
||||
it.extension.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID
|
||||
} as List<InspectionToolWrapper<InspectionProfileEntry, InspectionEP>>
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadKotlinInspectionExtensions() =
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.intentions
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionActionBean
|
||||
import com.intellij.codeInsight.intention.IntentionManager
|
||||
import com.intellij.codeInsight.intention.impl.config.IntentionManagerImpl
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
@@ -56,7 +57,7 @@ class IntentionDescriptionTest : LightPlatformTestCase() {
|
||||
private fun String.isXmlIntentionName() = startsWith("Add") && endsWith("ToManifest")
|
||||
|
||||
private fun loadKotlinIntentions(): List<IntentionActionBean> {
|
||||
val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS)
|
||||
val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManagerImpl.EP_INTENTION_ACTIONS)
|
||||
return extensionPoint.extensions.toList().filter {
|
||||
it.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID
|
||||
}
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.idea.intentions
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionActionBean
|
||||
import com.intellij.codeInsight.intention.IntentionManager
|
||||
import com.intellij.codeInsight.intention.impl.config.IntentionManagerImpl
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
@@ -57,7 +56,7 @@ class IntentionDescriptionTest : LightPlatformTestCase() {
|
||||
private fun String.isXmlIntentionName() = startsWith("Add") && endsWith("ToManifest")
|
||||
|
||||
private fun loadKotlinIntentions(): List<IntentionActionBean> {
|
||||
val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManagerImpl.EP_INTENTION_ACTIONS)
|
||||
val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS)
|
||||
return extensionPoint.extensions.toList().filter {
|
||||
it.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.idea.navigation
|
||||
|
||||
import com.intellij.ide.util.gotoByName.FilteringGotoByModel
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.ide.util.gotoByName.LanguageRef
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
@@ -20,7 +20,7 @@ object GotoCheck {
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun checkGotoDirectives(
|
||||
model: FilteringGotoByModel<Language>,
|
||||
model: FilteringGotoByModel<LanguageRef>,
|
||||
editor: Editor,
|
||||
nonProjectSymbols: Boolean = false,
|
||||
checkNavigation: Boolean = false
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.idea.navigation
|
||||
|
||||
import com.intellij.ide.util.gotoByName.FilteringGotoByModel
|
||||
import com.intellij.ide.util.gotoByName.LanguageRef
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
@@ -20,7 +20,7 @@ object GotoCheck {
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun checkGotoDirectives(
|
||||
model: FilteringGotoByModel<LanguageRef>,
|
||||
model: FilteringGotoByModel<Language>,
|
||||
editor: Editor,
|
||||
nonProjectSymbols: Boolean = false,
|
||||
checkNavigation: Boolean = false
|
||||
+3
-5
@@ -23,17 +23,15 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.picocontainer.MutablePicoContainer
|
||||
|
||||
abstract class AbstractAdditionalResolveDescriptorRendererTest : AbstractDescriptorRendererTest() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
val pomModelImpl = PomModelImpl(project)
|
||||
val treeAspect = TreeAspect(pomModelImpl)
|
||||
|
||||
val mockProject = project as MockProject
|
||||
createAndRegisterKotlinCodeBlockModificationListener(mockProject, pomModelImpl, treeAspect)
|
||||
mockProject.registerService(TreeAspect::class.java, TreeAspect())
|
||||
mockProject.registerService(PomModel::class.java, PomModelImpl(project))
|
||||
mockProject.registerService(KotlinCodeBlockModificationListener::class.java, KotlinCodeBlockModificationListener(mockProject))
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
|
||||
+5
-3
@@ -23,15 +23,17 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.picocontainer.MutablePicoContainer
|
||||
|
||||
abstract class AbstractAdditionalResolveDescriptorRendererTest : AbstractDescriptorRendererTest() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
|
||||
val pomModelImpl = PomModelImpl(project)
|
||||
val treeAspect = TreeAspect(pomModelImpl)
|
||||
|
||||
val mockProject = project as MockProject
|
||||
mockProject.registerService(TreeAspect::class.java, TreeAspect())
|
||||
mockProject.registerService(PomModel::class.java, PomModelImpl(project))
|
||||
mockProject.registerService(KotlinCodeBlockModificationListener::class.java, KotlinCodeBlockModificationListener(mockProject))
|
||||
createAndRegisterKotlinCodeBlockModificationListener(mockProject, pomModelImpl, treeAspect)
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
@@ -9,6 +9,7 @@ import com.intellij.analysis.AnalysisScope
|
||||
import com.intellij.ide.projectView.TreeStructureProvider
|
||||
import com.intellij.ide.util.treeView.AbstractTreeStructureBase
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.PsiSearchScopeUtil
|
||||
import com.intellij.slicer.DuplicateMap
|
||||
import com.intellij.slicer.SliceAnalysisParams
|
||||
import com.intellij.slicer.SliceNode
|
||||
@@ -63,7 +64,7 @@ internal fun buildTreeRepresentation(rootNode: SliceNode): String {
|
||||
|
||||
else -> {
|
||||
val chunks = usage.text
|
||||
if (!projectScope.contains(usage.element)) {
|
||||
if (!PsiSearchScopeUtil.isInScope(projectScope, usage.element!!)) {
|
||||
append("LIB ")
|
||||
} else {
|
||||
append(chunks.first().render() + " ")
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ import com.intellij.analysis.AnalysisScope
|
||||
import com.intellij.ide.projectView.TreeStructureProvider
|
||||
import com.intellij.ide.util.treeView.AbstractTreeStructureBase
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.PsiSearchScopeUtil
|
||||
import com.intellij.slicer.DuplicateMap
|
||||
import com.intellij.slicer.SliceAnalysisParams
|
||||
import com.intellij.slicer.SliceNode
|
||||
@@ -64,7 +63,7 @@ internal fun buildTreeRepresentation(rootNode: SliceNode): String {
|
||||
|
||||
else -> {
|
||||
val chunks = usage.text
|
||||
if (!PsiSearchScopeUtil.isInScope(projectScope, usage.element!!)) {
|
||||
if (!projectScope.contains(usage.element)) {
|
||||
append("LIB ")
|
||||
} else {
|
||||
append(chunks.first().render() + " ")
|
||||
@@ -40,10 +40,10 @@ abstract class AbstractMultiHighlightingTest : AbstractMultiModuleTest() {
|
||||
|
||||
val text = myEditor.document.text
|
||||
if (shouldCheckLineMarkers) {
|
||||
data.checkLineMarkers(DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text)
|
||||
data.checkLineMarkers(myFile, DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text)
|
||||
}
|
||||
if (shouldCheckResult) {
|
||||
data.checkResult(infos, text)
|
||||
data.checkResult(myFile, infos, text)
|
||||
}
|
||||
return infos
|
||||
}
|
||||
|
||||
+2
-2
@@ -40,10 +40,10 @@ abstract class AbstractMultiHighlightingTest : AbstractMultiModuleTest() {
|
||||
|
||||
val text = myEditor.document.text
|
||||
if (shouldCheckLineMarkers) {
|
||||
data.checkLineMarkers(myFile, DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text)
|
||||
data.checkLineMarkers(DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text)
|
||||
}
|
||||
if (shouldCheckResult) {
|
||||
data.checkResult(myFile, infos, text)
|
||||
data.checkResult(infos, text)
|
||||
}
|
||||
return infos
|
||||
}
|
||||
Reference in New Issue
Block a user