make trigram index psi dependent

GitOrigin-RevId: 44cccc22ef3c973c95df830701ecfc54ae8cbdca
This commit is contained in:
Dmitry Batkovich
2020-06-16 16:21:43 +03:00
committed by intellij-monorepo-bot
parent 9930641b54
commit 477c4fabb7
5 changed files with 7 additions and 20 deletions
@@ -1,14 +0,0 @@
// Copyright 2000-2019 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.util.indexing;
import org.jetbrains.annotations.ApiStatus;
/**
* Marker interface of index that use document changes to update it's data. These indices shouldn't depend on PSI-related stuff.
*
* Note, every {@link FileBasedIndexExtension} where {@link FileBasedIndexExtension#dependsOnFileContent()} returns false is treated as document change dependent.
*/
@ApiStatus.Experimental
public interface DocumentChangeDependentIndex {
}
@@ -18,7 +18,7 @@ package com.intellij.util.indexing;
/**
* Marker interface of index that is built from PSI, meaning its invalidation will happen upon producing new PSI.
*
* @deprecated by default all content-aware indices are PSI dependent. Use {@link DocumentChangeDependentIndex} to make index PSI-independent (since 2019.2)
* @deprecated by default all content-aware indices are PSI dependent.
*/
@Deprecated
public interface PsiDependentIndex {
@@ -108,7 +108,10 @@ class FindInProjectTask {
try {
myProgress.setIndeterminate(true);
myProgress.setText(FindBundle.message("progress.text.scanning.indexed.files"));
Set<VirtualFile> filesForFastWordSearch = ReadAction.nonBlocking(this::getFilesForFastWordSearch).executeSynchronously();
Set<VirtualFile> filesForFastWordSearch = ReadAction
.nonBlocking(this::getFilesForFastWordSearch)
.withDocumentsCommitted(myProject)
.executeSynchronously();
myProgress.setIndeterminate(false);
if (LOG.isDebugEnabled()) {
LOG.debug("Searching for " + myFindModel.getStringToFind() + " in " + filesForFastWordSearch.size() + " indexed files");
@@ -19,8 +19,7 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.*;
public final class TrigramIndex extends ScalarIndexExtension<Integer> implements CustomInputsIndexFileBasedIndexExtension<Integer>,
DocumentChangeDependentIndex {
public final class TrigramIndex extends ScalarIndexExtension<Integer> implements CustomInputsIndexFileBasedIndexExtension<Integer> {
/**
* @deprecated not used anymore, always enabled
*/
@@ -1821,8 +1821,7 @@ public final class FileBasedIndexImpl extends FileBasedIndexEx {
public static boolean isPsiDependentIndex(@NotNull IndexExtension<?, ?, ?> extension) {
if (INDICES_ARE_PSI_DEPENDENT_BY_DEFAULT) {
return extension instanceof FileBasedIndexExtension &&
((FileBasedIndexExtension<?, ?>)extension).dependsOnFileContent() &&
!(extension instanceof DocumentChangeDependentIndex);
((FileBasedIndexExtension<?, ?>)extension).dependsOnFileContent();
}
else {
return extension instanceof PsiDependentIndex;