@@ -7,12 +7,14 @@ import com.emberjs.icons.EmberIcons
77import com.intellij.lang.annotation.AnnotationHolder
88import com.intellij.lang.javascript.linter.*
99import com.intellij.lang.javascript.psi.JSFile
10+ import com.intellij.openapi.application.ApplicationManager
1011import com.intellij.openapi.editor.Editor
1112import com.intellij.openapi.project.Project
1213import com.intellij.openapi.util.text.StringUtil
1314import com.intellij.openapi.vfs.VirtualFile
1415import com.intellij.psi.PsiDocumentManager
1516import com.intellij.psi.PsiFile
17+ import java.util.concurrent.Future
1618
1719class TemplateLintExternalAnnotator (onTheFly : Boolean = true ) : JSLinterExternalAnnotator<TemplateLintState>(onTheFly) {
1820 companion object {
@@ -46,16 +48,20 @@ class TemplateLintExternalAnnotator(onTheFly: Boolean = true) : JSLinterExternal
4648
4749 override fun annotate (input : JSLinterInput <TemplateLintState >): JSLinterAnnotationResult ? {
4850 var res: JSLinterAnnotationResult ? = null
49- try {
50- res = TemplateLintExternalRunner (this .isOnTheFly).highlight(input)
51- } catch (ex: Exception ) {
52- res = null
53- println (ex)
54- }
51+ var p = ApplicationManager .getApplication().executeOnPooledThread {
52+ try {
53+ res = TemplateLintExternalRunner (this .isOnTheFly).highlight(input)
54+ } catch (ex: Exception ) {
55+ res = null
56+ println (ex)
57+ }
5558
56- val errors: MutableList <JSLinterError > = mutableListOf ()
57- errors.addAll(res?.errors ? : listOf ())
58- return JSLinterAnnotationResult .createLinterResult(input, errors.toList(), null as VirtualFile ? )
59+ val errors: MutableList <JSLinterError > = mutableListOf ()
60+ errors.addAll(res?.errors ? : listOf ())
61+ res = JSLinterAnnotationResult .createLinterResult(input, errors.toList(), null as VirtualFile ? )
62+ }
63+ p.get()
64+ return res
5965 }
6066
6167 override fun apply (file : PsiFile , annotationResult : JSLinterAnnotationResult ? , holder : AnnotationHolder ) {
0 commit comments