summaryrefslogtreecommitdiff
path: root/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java')
-rw-r--r--platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java51
1 files changed, 28 insertions, 23 deletions
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
index 5242ee3b70cf..85077380ea6e 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
@@ -1964,33 +1964,38 @@ public class FileBasedIndexImpl extends FileBasedIndex {
// For 'normal indices' schedule the file for update and reset stamps for all affected indices (there
// can be client that used indices between before and after events, in such case indices are up to date due to force update
// with old content)
- if (!fileIsDirectory && !isTooLarge(file)) {
- FileTypeManagerImpl.cacheFileType(file, file.getFileType());
- try {
- final List<ID<?, ?>> candidates = getAffectedIndexCandidates(file);
- //noinspection ForLoopReplaceableByForEach
- boolean scheduleForUpdate = false;
- boolean resetStamp = false;
-
- //noinspection ForLoopReplaceableByForEach
- for (int i = 0, size = candidates.size(); i < size; ++i) {
- final ID<?, ?> indexId = candidates.get(i);
- if (needsFileContentLoading(indexId) && getInputFilter(indexId).acceptInput(file)) {
- if (IndexingStamp.isFileIndexedStateCurrent(file, indexId)) {
- IndexingStamp.setFileIndexedStateOutdated(file, indexId);
- resetStamp = true;
+ if (!fileIsDirectory) {
+ if (isTooLarge(file)) {
+ // large file might be scheduled for update in before event when its size was not large
+ myChangedFilesCollector.myFilesToUpdate.remove(file);
+ } else {
+ FileTypeManagerImpl.cacheFileType(file, file.getFileType());
+ try {
+ final List<ID<?, ?>> candidates = getAffectedIndexCandidates(file);
+ //noinspection ForLoopReplaceableByForEach
+ boolean scheduleForUpdate = false;
+ boolean resetStamp = false;
+
+ //noinspection ForLoopReplaceableByForEach
+ for (int i = 0, size = candidates.size(); i < size; ++i) {
+ final ID<?, ?> indexId = candidates.get(i);
+ if (needsFileContentLoading(indexId) && getInputFilter(indexId).acceptInput(file)) {
+ if (IndexingStamp.isFileIndexedStateCurrent(file, indexId)) {
+ IndexingStamp.setFileIndexedStateOutdated(file, indexId);
+ resetStamp = true;
+ }
+ scheduleForUpdate = true;
}
- scheduleForUpdate = true;
}
- }
- if (scheduleForUpdate) {
- if (resetStamp) IndexingStamp.flushCache(file);
- scheduleForUpdate(file);
+ if (scheduleForUpdate) {
+ if (resetStamp) IndexingStamp.flushCache(file);
+ scheduleForUpdate(file);
+ }
+ }
+ finally {
+ FileTypeManagerImpl.cacheFileType(file, null);
}
- }
- finally {
- FileTypeManagerImpl.cacheFileType(file, null);
}
}