mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test [platform]: commit all documents in psiFile fixture to avoid getting an outdated psi.
GitOrigin-RevId: cf0282daac2e99c7881c0d35e310d050ef0870b3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a16a32fec5
commit
5ef2aa7048
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx
|
||||
import com.intellij.openapi.roots.ModuleRootManager
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil
|
||||
import com.intellij.openapi.util.Computable
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.toCanonicalPath
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
@@ -271,9 +272,9 @@ fun TestFixture<PsiDirectory>.psiFileFixture(
|
||||
): TestFixture<PsiFile> = testFixture { _ ->
|
||||
val project = this@psiFileFixture.init().project
|
||||
val virtualFile = virtualFileFixture(name, content).init()
|
||||
val file = readAction {
|
||||
val file = PsiDocumentManager.getInstance(project).commitAndRunReadAction(Computable {
|
||||
PsiManager.getInstance(project).findFile(virtualFile) ?: error("Fail to find file $virtualFile")
|
||||
}
|
||||
})
|
||||
initialized(file) {/*nothing*/ }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user