mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
Switch IndexableFilesIndex.isIntegrationFullyEnabled() and shouldBeUsed() to isEnabled()
GitOrigin-RevId: d382ee577fac48f45fb1d8804c6f845baccfbf9e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
38617a4ed1
commit
6f1fa5c4e6
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.indexing;
|
||||
|
||||
import com.intellij.ide.lightEdit.LightEditCompatible;
|
||||
@@ -562,7 +562,7 @@ public abstract class FileBasedIndexEx extends FileBasedIndex {
|
||||
if (project instanceof LightEditCompatible) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (IndexableFilesIndex.isIntegrationFullyEnabled() && allowedIteratorPatterns.isEmpty()) {
|
||||
if (IndexableFilesIndex.isEnabled() && allowedIteratorPatterns.isEmpty()) {
|
||||
return IndexableFilesIndex.getInstance(project).getIndexingIterators();
|
||||
}
|
||||
List<IndexableFilesIterator> providers = IndexableFilesContributor.EP_NAME
|
||||
|
||||
@@ -25,20 +25,16 @@ public interface IndexableFilesIndex {
|
||||
/**
|
||||
* See {@link com.intellij.util.indexing.roots.StandardContributorsKt#shouldIndexProjectBasedOnIndexableEntityProviders()}
|
||||
*/
|
||||
static boolean shouldBeUsed() {
|
||||
static boolean isEnabled() {
|
||||
return (Registry.is("indexing.use.indexable.files.index") ||
|
||||
(ApplicationManager.getApplication().isUnitTestMode() && TestModeFlags.is(ENABLE_IN_TESTS))) &&
|
||||
WorkspaceFileIndexEx.IS_ENABLED &&
|
||||
Registry.is("indexing.enable.entity.provider.based.indexing");
|
||||
}
|
||||
|
||||
static boolean isIntegrationFullyEnabled(){
|
||||
return shouldBeUsed() && Registry.is("indexing.fully.use.indexable.files.index");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static IndexableFilesIndex getInstance(@NotNull Project project) {
|
||||
assert shouldBeUsed();
|
||||
assert isEnabled();
|
||||
return project.getService(IndexableFilesIndex.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ public final class FileBasedIndexImpl extends FileBasedIndexEx {
|
||||
|
||||
@Override
|
||||
public void registerProjectFileSets(@NotNull Project project) {
|
||||
if (IndexableFilesIndex.isIntegrationFullyEnabled()) {
|
||||
if (IndexableFilesIndex.isEnabled()) {
|
||||
registerIndexableSet(new IndexableFileSet() {
|
||||
@Override
|
||||
public boolean isInSet(@NotNull VirtualFile file) {
|
||||
|
||||
@@ -38,7 +38,7 @@ object IndexableEntityProviderMethods {
|
||||
fun createIterators(entity: ModuleEntity, entityStorage: EntityStorage, project: Project): Collection<IndexableFilesIterator> {
|
||||
if (shouldIndexProjectBasedOnIndexableEntityProviders()) {
|
||||
if (entity.isModuleUnloaded(entityStorage)) return emptyList()
|
||||
if (IndexableFilesIndex.isIntegrationFullyEnabled()) {
|
||||
if (IndexableFilesIndex.isEnabled()) {
|
||||
return IndexableFilesIndex.getInstance(project).getModuleIndexingIterators(entity, entityStorage)
|
||||
}
|
||||
val builders = mutableListOf<IndexableEntityProvider.IndexableIteratorBuilder>()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.indexing.roots
|
||||
|
||||
import com.intellij.ide.lightEdit.LightEdit
|
||||
@@ -26,7 +26,7 @@ import java.util.function.Predicate
|
||||
|
||||
internal class DefaultProjectIndexableFilesContributor : IndexableFilesContributor {
|
||||
override fun getIndexableFiles(project: Project): List<IndexableFilesIterator> {
|
||||
assert(!IndexableFilesIndex.isIntegrationFullyEnabled()) { "Shouldn't be used with IndexableFilesIndex fully enabled" }
|
||||
assert(!IndexableFilesIndex.isEnabled()) { "Shouldn't be used with IndexableFilesIndex fully enabled" }
|
||||
val providers: List<IndexableFilesIterator>
|
||||
if (shouldIndexProjectBasedOnIndexableEntityProviders()) {
|
||||
val builders: MutableList<IndexableEntityProvider.IndexableIteratorBuilder> = mutableListOf()
|
||||
@@ -79,7 +79,7 @@ internal class DefaultProjectIndexableFilesContributor : IndexableFilesContribut
|
||||
|
||||
override fun getOwnFilePredicate(project: Project): Predicate<VirtualFile> {
|
||||
val projectFileIndex: ProjectFileIndex = ProjectFileIndex.getInstance(project)
|
||||
val indexableFilesIndex: IndexableFilesIndex? = if (IndexableFilesIndex.isIntegrationFullyEnabled())
|
||||
val indexableFilesIndex: IndexableFilesIndex? = if (IndexableFilesIndex.isEnabled())
|
||||
IndexableFilesIndex.getInstance(project)
|
||||
else null
|
||||
|
||||
|
||||
@@ -120,8 +120,6 @@
|
||||
serviceImplementation="com.intellij.util.indexing.roots.IndexableFilesIndexImpl"/>
|
||||
<registryKey defaultValue="false" key="indexing.use.indexable.files.index" restartRequired="true"
|
||||
description="Create separate index to determine fileset to index; needs `indexing.enable.entity.provider.based.indexing` and `platform.projectModel.workspace.model.file.index` enabled to become enabled"/>
|
||||
<registryKey defaultValue="false" key="indexing.fully.use.indexable.files.index" restartRequired="true"
|
||||
description="Always use IndexableFilesIndex when indexing; needs `indexing.use.indexable.files.index` enabled to become enabled"/>
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.packageDependencies.DependencyUISettings"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user