Enable run inspection pass after completion of general highlight pass for kotlin-specific project only
Relates to #KT-37553
This commit is contained in:
@@ -6,14 +6,27 @@
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.ReadAction.nonBlocking
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.idea.util.runWhenSmart
|
||||
import com.intellij.psi.search.FileTypeIndex
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
// BUNCH: 201
|
||||
|
||||
fun runActivity(project: Project) {
|
||||
project.runWhenSmart {
|
||||
val daemonCodeAnalyzer = DaemonCodeAnalyzerImpl.getInstanceEx(project) as DaemonCodeAnalyzerImpl
|
||||
daemonCodeAnalyzer.runLocalInspectionPassAfterCompletionOfGeneralHighlightPass(true)
|
||||
}
|
||||
nonBlocking(Callable {
|
||||
return@Callable FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, GlobalSearchScope.projectScope(project))
|
||||
})
|
||||
.inSmartMode(project)
|
||||
.expireWith(project)
|
||||
.finishOnUiThread(ModalityState.any()) { hasKotlinFiles ->
|
||||
if (!hasKotlinFiles) return@finishOnUiThread
|
||||
|
||||
val daemonCodeAnalyzer = DaemonCodeAnalyzerImpl.getInstanceEx(project) as DaemonCodeAnalyzerImpl
|
||||
daemonCodeAnalyzer.runLocalInspectionPassAfterCompletionOfGeneralHighlightPass(true)
|
||||
}
|
||||
.submit(AppExecutorUtil.getAppExecutorService())
|
||||
}
|
||||
Reference in New Issue
Block a user