mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
drop workspace file index on vfs reconnect (it store virtual files directly to field values and it has to be dropped)
GitOrigin-RevId: ba2302b2e860845ddaaa1b2a1305d24e2d6ba768
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d3686c6815
commit
ba7f69a168
@@ -85,6 +85,8 @@
|
||||
description="Enable workspace model consistency checking after every update"/>
|
||||
|
||||
<postStartupActivity implementation="com.intellij.workspaceModel.ide.impl.WorkspaceEntitiesLifecycleActivity"/>
|
||||
|
||||
<persistentFsConnectionListener implementation="com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexCleaner"/>
|
||||
</extensions>
|
||||
|
||||
<projectListeners>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.workspaceModel.core.fileIndex.impl
|
||||
|
||||
import com.intellij.openapi.components.serviceIfCreated
|
||||
import com.intellij.openapi.project.ProjectManager
|
||||
import com.intellij.openapi.roots.ContentIteratorEx
|
||||
import com.intellij.openapi.vfs.AsyncFileListener
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileFilter
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFsConnectionListener
|
||||
import com.intellij.platform.workspace.storage.EntityReference
|
||||
import com.intellij.platform.workspace.storage.WorkspaceEntity
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
@@ -13,9 +16,7 @@ import com.intellij.workspaceModel.core.fileIndex.WorkspaceFileIndex
|
||||
import com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSet
|
||||
import com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSetData
|
||||
import com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSetWithCustomData
|
||||
import com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileInternalInfo.NonWorkspace
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
|
||||
interface WorkspaceFileIndexEx : WorkspaceFileIndex {
|
||||
/**
|
||||
@@ -79,10 +80,19 @@ interface WorkspaceFileIndexEx : WorkspaceFileIndex {
|
||||
@ApiStatus.Internal
|
||||
fun visitFileSets(visitor: WorkspaceFileSetVisitor)
|
||||
|
||||
@TestOnly
|
||||
@ApiStatus.Internal
|
||||
fun reset()
|
||||
}
|
||||
|
||||
internal class WorkspaceFileIndexCleaner: PersistentFsConnectionListener {
|
||||
override fun beforeConnectionClosed() {
|
||||
for (p in ProjectManager.getInstanceIfCreated()?.openProjects.orEmpty()) {
|
||||
val fileIndex = p.serviceIfCreated<WorkspaceFileIndex>() as WorkspaceFileIndexEx? ?: continue
|
||||
fileIndex.reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A base interface for instances which may be returned from [WorkspaceFileIndexEx.getFileInfo]:
|
||||
* * [NonWorkspace] if no file set is associated;
|
||||
|
||||
Reference in New Issue
Block a user