From 7350d48cb81adc59bd17b732a8deff995205a57e Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 19 Jun 2013 13:30:19 +0200 Subject: [PATCH] more stub+ast diagnostics --- .../src/com/intellij/psi/stubs/StubTreeLoaderImpl.java | 6 +++++- .../com/intellij/util/indexing/FileBasedIndexImpl.java | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java index 339bcf7ee442..80ef8e752186 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java @@ -94,7 +94,10 @@ public class StubTreeLoaderImpl extends StubTreeLoader { return null; } - boolean wasIndexedAlready = FileBasedIndexImpl.isFileIndexed(vFile, StubUpdatingIndex.INDEX_ID); + boolean wasIndexedAlready = ((FileBasedIndexImpl)FileBasedIndex.getInstance()).isFileUpToDate(vFile); + + Document document = FileDocumentManager.getInstance().getCachedDocument(vFile); + boolean saved = document == null || FileDocumentManager.getInstance().isDocumentUnsaved(document); final List datas = FileBasedIndex.getInstance().getValues(StubUpdatingIndex.INDEX_ID, id, GlobalSearchScope .fileScope(project, vFile)); @@ -111,6 +114,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader { ObjectStubTree tree = stub instanceof PsiFileStub ? new StubTree((PsiFileStub)stub) : new ObjectStubTree((ObjectStubBase)stub, true); tree.setDebugInfo("created from index: " + StubUpdatingIndex.getIndexingStampInfo(vFile) + ", wasIndexedAlready=" + wasIndexedAlready + + ", saved=" + saved + ", queried at " + vFile.getTimeStamp()); return tree; } 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 a2c433b6309f..110953382288 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -1718,9 +1718,13 @@ public class FileBasedIndexImpl extends FileBasedIndex { }); } + public boolean isFileUpToDate(VirtualFile file) { + return !myChangedFilesCollector.myFilesToUpdate.contains(file); + } + void processRefreshedFile(@NotNull Project project, @NotNull final com.intellij.ide.caches.FileContent fileContent) { myChangedFilesCollector.ensureAllInvalidateTasksCompleted(); - myChangedFilesCollector.processFileImpl(project, fileContent, false); // ProcessCanceledException will cause readding the file to processing list + myChangedFilesCollector.processFileImpl(project, fileContent, false); // ProcessCanceledException will cause re-adding the file to processing list } public void indexFileContent(@Nullable Project project, @NotNull com.intellij.ide.caches.FileContent content) { @@ -2347,7 +2351,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { (isMock(file) || !isFileIndexed(file, indexId)); } - public static boolean isFileIndexed(VirtualFile file, ID indexId) { + private static boolean isFileIndexed(VirtualFile file, ID indexId) { ID id = IndexInfrastructure.getStubId(indexId, file.getFileType()); return IndexingStamp.isFileIndexed(file, id, IndexInfrastructure.getIndexCreationStamp(id)); }