WEB-47997: A *.ts file isn't removed from the Project Errors tab in the Problems view, after deleting it

GitOrigin-RevId: 5e5b5024e578e18c7dbed1412b72a5a4e559ed42
This commit is contained in:
Sergey Malenkov
2021-03-24 14:35:05 +00:00
committed by intellij-monorepo-bot
parent af2809e4c8
commit 848266ad5c
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.analysis.problemsView.toolWindow
import com.intellij.analysis.problemsView.FileProblem
@@ -9,6 +9,10 @@ import com.intellij.analysis.problemsView.ProblemsListener
import com.intellij.icons.AllIcons.Toolwindows
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
import com.intellij.openapi.vfs.newvfs.events.VFileMoveEvent
import com.intellij.ui.AppUIUtil
import java.util.concurrent.atomic.AtomicInteger
@@ -114,4 +118,15 @@ private class ProjectErrorsCollector(val project: Project) : ProblemsCollector {
true -> Toolwindows.ToolWindowProblemsEmpty
else -> Toolwindows.ToolWindowProblems
}
private fun onVfsChanges(events: List<VFileEvent>) = events
.filter { it is VFileDeleteEvent || it is VFileMoveEvent }
.mapNotNull { it.file }
.distinct()
.flatMap { getFileProblems(it) }
.forEach { problemDisappeared(it) }
init {
VirtualFileManager.getInstance().addAsyncFileListener({ onVfsChanges(it);null }, project)
}
}