mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
earlier stub-psi mismatch diagnostics revival
This commit is contained in:
@@ -23,6 +23,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
@@ -94,12 +95,13 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
|
||||
SerializedStubTree stubTree = datas.get(0);
|
||||
|
||||
if (!stubTree.contentLengthMatches(vFile.getLength(), getCurrentTextContentLength(project, vFile, document))) {
|
||||
//todo find another way of early stub-ast mismatch prevention
|
||||
//return processError(vFile,
|
||||
// "Outdated stub in index: " + StubUpdatingIndex.getIndexingStampInfo(vFile) +
|
||||
// ", docSaved=" + saved +
|
||||
// ", queried at " + vFile.getTimeStamp(),
|
||||
// null);
|
||||
return processError(vFile,
|
||||
"Outdated stub in index: " + StubUpdatingIndex.getIndexingStampInfo(vFile) +
|
||||
", doc=" + document +
|
||||
", docSaved=" + saved +
|
||||
", wasIndexedAlready=" + wasIndexedAlready +
|
||||
", queried at " + vFile.getTimeStamp(),
|
||||
null);
|
||||
}
|
||||
|
||||
Stub stub;
|
||||
@@ -131,7 +133,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
|
||||
}
|
||||
|
||||
if (document != null) {
|
||||
return document.getTextLength();
|
||||
return PsiDocumentManager.getInstance(project).getLastCommittedText(document).length();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.StubUpdatingIndex");
|
||||
|
||||
// todo remove once we don't need this for stub-ast mismatch debug info
|
||||
private static final FileAttribute INDEXED_STAMP = new FileAttribute("stubIndexStamp", 1, false);
|
||||
private static final FileAttribute INDEXED_STAMP = new FileAttribute("stubIndexStamp", 2, false);
|
||||
|
||||
public static final ID<Integer, SerializedStubTree> INDEX_ID = ID.create("Stubs");
|
||||
|
||||
@@ -127,7 +127,13 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
|
||||
if (rootStub == null) return;
|
||||
|
||||
VirtualFile file = inputData.getFile();
|
||||
int contentLength = file.getFileType().isBinary() ? -1 : inputData.getContentAsText().length();
|
||||
int contentLength;
|
||||
if (file.getFileType().isBinary()) {
|
||||
contentLength = -1;
|
||||
}
|
||||
else {
|
||||
contentLength = ((FileContentImpl)inputData).getPsiFileForPsiDependentIndex().getTextLength();
|
||||
}
|
||||
rememberIndexingStamp(file, contentLength);
|
||||
|
||||
final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream();
|
||||
|
||||
Reference in New Issue
Block a user