@@ -21,6 +21,8 @@ import com.intellij.codeInsight.hints.InlayHintsSink
21
21
import com.intellij.codeInsight.hints.NoSettings
22
22
import com.intellij.codeInsight.hints.SettingsKey
23
23
import com.intellij.json.psi.JsonFile
24
+ import com.intellij.openapi.application.ApplicationManager
25
+ import com.intellij.openapi.application.ReadAction
24
26
import com.intellij.openapi.editor.Editor
25
27
import com.intellij.psi.PsiElement
26
28
import com.intellij.psi.PsiFile
@@ -51,7 +53,7 @@ internal class ResourceEditorInlayHintsProvider : InlayHintsProvider<NoSettings>
51
53
}
52
54
}
53
55
54
- override fun getCollectorFor (file : PsiFile , editor : Editor , settings : NoSettings , sink : InlayHintsSink ): InlayHintsCollector ? {
56
+ override fun getCollectorFor (file : PsiFile , editor : Editor , settings : NoSettings , sink : InlayHintsSink ): InlayHintsCollector {
55
57
return Collector (editor)
56
58
}
57
59
@@ -75,16 +77,21 @@ internal class ResourceEditorInlayHintsProvider : InlayHintsProvider<NoSettings>
75
77
}
76
78
77
79
private fun create (file : YAMLFile , sink : InlayHintsSink , editor : Editor ) {
78
- file.documents.forEach { document ->
79
- val info = KubernetesTypeInfo .extractMeta(document) ? : return
80
- val element = document.topLevelValue ? : return
81
- Base64Presentations .create(element, info, sink, editor)?.create()
80
+ return ReadAction .run<Exception > {
81
+ file.documents.forEach { document ->
82
+ val info = KubernetesTypeInfo .extractMeta(document) ? : return @forEach
83
+ val element = document.topLevelValue ? : return @forEach
84
+ Base64Presentations .create(element, info, sink, editor)?.create()
85
+ }
82
86
}
83
87
}
84
88
85
89
private fun create (file : JsonFile , sink : InlayHintsSink , editor : Editor ) {
86
- val info = KubernetesTypeInfo .extractMeta(file) ? : return
87
- Base64Presentations .create(file, info, sink, editor)?.create()
90
+ return ReadAction .run<Exception > {
91
+ val info = KubernetesTypeInfo .extractMeta(file) ? : return @run
92
+ val element = file.topLevelValue ? : return @run
93
+ Base64Presentations .create(element, info, sink, editor)?.create()
94
+ }
88
95
}
89
96
90
97
}
0 commit comments