mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Indexing: do not set "isIndexed" flag for resurrected files if they haven't been fully indexed.
We used to set up flag (VirtualFileSystemEntry.setFileIndexed) for resurrected files always, even if doIndexFileContent returned "false". GitOrigin-RevId: a78154f951b3b39ed8bda2b1ac41f087840052c1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
19206b1c71
commit
2cce738f33
@@ -1196,6 +1196,7 @@ public final class FileBasedIndexImpl extends FileBasedIndexEx {
|
||||
VirtualFile file = content.getVirtualFile();
|
||||
final int fileId = Math.abs(getIdMaskingNonIdBasedFile(file));
|
||||
|
||||
FileIndexingResult indexingResult;
|
||||
long startTime = System.nanoTime();
|
||||
try {
|
||||
// if file was scheduled for update due to vfs events then it is present in myFilesToUpdate
|
||||
@@ -1206,31 +1207,23 @@ public final class FileBasedIndexImpl extends FileBasedIndexEx {
|
||||
if (!file.isValid() || isTooLarge(file)) {
|
||||
ProgressManager.checkCanceled();
|
||||
removeDataFromIndicesForFile(fileId, file);
|
||||
try {
|
||||
if (file instanceof DeletedVirtualFileStub && ((DeletedVirtualFileStub)file).isResurrected()) {
|
||||
CachedFileContent resurrectedFileContent = new CachedFileContent(((DeletedVirtualFileStub)file).getOriginalFile());
|
||||
FileIndexingResult indexingResult = doIndexFileContent(project, resurrectedFileContent);
|
||||
return new FileIndexingStatistics(System.nanoTime() - startTime,
|
||||
indexingResult.fileType,
|
||||
indexingResult.timesPerIndexer);
|
||||
} else {
|
||||
return new FileIndexingStatistics(System.nanoTime() - startTime,
|
||||
file.getFileType(),
|
||||
Collections.emptyMap());
|
||||
}
|
||||
} finally {
|
||||
setIsIndexedFlag(file);
|
||||
if (file instanceof DeletedVirtualFileStub && ((DeletedVirtualFileStub)file).isResurrected()) {
|
||||
CachedFileContent resurrectedFileContent = new CachedFileContent(((DeletedVirtualFileStub)file).getOriginalFile());
|
||||
indexingResult = doIndexFileContent(project, resurrectedFileContent);
|
||||
} else {
|
||||
indexingResult = new FileIndexingResult(true, Collections.emptyMap(), file.getFileType());
|
||||
}
|
||||
}
|
||||
else {
|
||||
FileIndexingResult indexingResult = doIndexFileContent(project, content);
|
||||
if (indexingResult.setIndexedStatus) {
|
||||
setIsIndexedFlag(file);
|
||||
}
|
||||
return new FileIndexingStatistics(System.nanoTime() - startTime,
|
||||
indexingResult.fileType,
|
||||
indexingResult.timesPerIndexer);
|
||||
indexingResult = doIndexFileContent(project, content);
|
||||
}
|
||||
|
||||
if (indexingResult.setIndexedStatus && file instanceof VirtualFileSystemEntry) {
|
||||
((VirtualFileSystemEntry)file).setFileIndexed(true);
|
||||
}
|
||||
return new FileIndexingStatistics(System.nanoTime() - startTime,
|
||||
indexingResult.fileType,
|
||||
indexingResult.timesPerIndexer);
|
||||
}
|
||||
finally {
|
||||
IndexingStamp.flushCache(fileId);
|
||||
@@ -1238,12 +1231,6 @@ public final class FileBasedIndexImpl extends FileBasedIndexEx {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIsIndexedFlag(@NotNull VirtualFile file) {
|
||||
if (file instanceof VirtualFileSystemEntry) {
|
||||
((VirtualFileSystemEntry)file).setFileIndexed(true);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class FileIndexingResult {
|
||||
public final boolean setIndexedStatus;
|
||||
public final Map<ID<?, ?>, Long> timesPerIndexer;
|
||||
|
||||
Reference in New Issue
Block a user