mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[code-vision] IJPL-174861 make sure blockingContextToIndicator is not used in tests
`blockingContextToIndicator` causes RenameAwareReferencesCodeVisionProvider test to fail, because there is no Job or indicator. IJ-MR-153718 GitOrigin-RevId: 08b0dbef38138d2a3abbadec9f0a633d2de5f6a4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8a3f99177f
commit
02be55a947
@@ -14,6 +14,7 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.markup.EffectType
|
||||
import com.intellij.openapi.editor.markup.TextAttributesEffectsBuilder
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.progress.blockingContextToIndicator
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.*
|
||||
@@ -287,11 +288,18 @@ object InlayHintsUtils {
|
||||
return storage
|
||||
}
|
||||
|
||||
fun computeCodeVisionUnderReadAction(computable: () -> CodeVisionState): CodeVisionState {
|
||||
fun computeCodeVisionUnderReadAction(expectsIndicator: Boolean = false, computable: () -> CodeVisionState): CodeVisionState {
|
||||
try {
|
||||
if (!EDT.isCurrentThreadEdt()) {
|
||||
return ReadAction.computeCancellable<CodeVisionState, Throwable> {
|
||||
return@computeCancellable computable.invoke()
|
||||
if (expectsIndicator) {
|
||||
blockingContextToIndicator {
|
||||
computable.invoke()
|
||||
}
|
||||
}
|
||||
else {
|
||||
computable.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.progress.blockingContextToIndicator
|
||||
import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.ProjectFileIndex
|
||||
@@ -49,13 +48,11 @@ abstract class RenameAwareReferencesCodeVisionProvider : CodeVisionProvider<Noth
|
||||
val stamp = ModificationStampUtil.getModificationStamp(editor)
|
||||
if (stamp != null && cached?.modificationStamp == stamp) return CodeVisionState.Ready(cached.codeVisionEntries)
|
||||
|
||||
return InlayHintsUtils.computeCodeVisionUnderReadAction ra@{
|
||||
return InlayHintsUtils.computeCodeVisionUnderReadAction(expectsIndicator = true) ra@{
|
||||
if (DumbService.isDumb(project)) {
|
||||
return@ra CodeVisionState.NotReady
|
||||
}
|
||||
blockingContextToIndicator {
|
||||
recomputeLenses(editor, project, stamp, cacheService)
|
||||
}
|
||||
recomputeLenses(editor, project, stamp, cacheService)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user