fix "read action required" exception

GitOrigin-RevId: e9d4e12d7cc3813f3948768d176677085dd6fc06
This commit is contained in:
Alexey Kudravtsev
2024-08-19 14:41:23 +02:00
committed by intellij-monorepo-bot
parent 30f8be6c4b
commit cbf42c105d

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl;
import com.intellij.openapi.application.ReadAction;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
@@ -12,6 +13,6 @@ import org.jetbrains.annotations.NotNull;
record InvalidPsi(@NotNull PsiElement psiElement, @NotNull HighlightInfo info) {
@Override
public String toString() {
return "InvalidPsi("+psiElement()+(psiElement().isValid() ? "" : "(invalid)")+","+info+")";
return ReadAction.compute(() -> "InvalidPsi(" + psiElement() + (psiElement().isValid() ? "" : "(invalid)") + "," + info + ")");
}
}