mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Enable todo indexing in content roots only
- all OpenProjects are used to avoid generating different indexing results for different projects - only content-files are included since IndexTodoCacheManagerImpl.getFilesWithTodoItems filter out all non-content todo-entries
This commit is contained in:
+17
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,9 @@ import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding;
|
||||
@@ -115,6 +118,10 @@ public class TodoIndex extends FileBasedIndexExtension<TodoIndexEntry, Integer>
|
||||
return false; // do not index TODOs in library sources
|
||||
}
|
||||
|
||||
if(!isInContentOfAnyProject(file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final FileType fileType = file.getFileType();
|
||||
|
||||
if (fileType instanceof LanguageFileType) {
|
||||
@@ -128,6 +135,15 @@ public class TodoIndex extends FileBasedIndexExtension<TodoIndexEntry, Integer>
|
||||
fileType instanceof CustomSyntaxTableFileType;
|
||||
};
|
||||
|
||||
private static boolean isInContentOfAnyProject(@NotNull VirtualFile file) {
|
||||
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
|
||||
if (ProjectFileIndex.getInstance(project).isInContent(file)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVersion() {
|
||||
int version = 9;
|
||||
|
||||
Reference in New Issue
Block a user