mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
todo index: get rid of file field in TokenSetTodoIndexer
GitOrigin-RevId: 582f0832ff44317e3120aafd9edad9c43c57bee3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
def80e2924
commit
4b12ff67d9
+5
-8
@@ -14,7 +14,6 @@ import com.intellij.openapi.fileTypes.InternalFileType;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.CustomHighlighterTokenType;
|
||||
import com.intellij.psi.impl.cache.CacheUtil;
|
||||
import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
|
||||
@@ -45,7 +44,7 @@ public abstract class PlatformIdTableBuilding {
|
||||
private PlatformIdTableBuilding() {}
|
||||
|
||||
@Nullable
|
||||
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
|
||||
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType) {
|
||||
final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
|
||||
if (extIndexer != null) {
|
||||
return extIndexer;
|
||||
@@ -56,12 +55,12 @@ public abstract class PlatformIdTableBuilding {
|
||||
final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
|
||||
final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
|
||||
if (commentTokens != null) {
|
||||
return new TokenSetTodoIndexer(commentTokens, virtualFile);
|
||||
return new TokenSetTodoIndexer(commentTokens);
|
||||
}
|
||||
}
|
||||
|
||||
if (fileType instanceof CustomSyntaxTableFileType) {
|
||||
return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
|
||||
return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -83,11 +82,9 @@ public abstract class PlatformIdTableBuilding {
|
||||
|
||||
private static class TokenSetTodoIndexer extends VersionedTodoIndexer {
|
||||
@NotNull private final TokenSet myCommentTokens;
|
||||
private final VirtualFile myFile;
|
||||
|
||||
TokenSetTodoIndexer(@NotNull final TokenSet commentTokens, @NotNull final VirtualFile file) {
|
||||
TokenSetTodoIndexer(@NotNull final TokenSet commentTokens) {
|
||||
myCommentTokens = commentTokens;
|
||||
myFile = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,7 +100,7 @@ public abstract class PlatformIdTableBuilding {
|
||||
highlighter = editorHighlighter;
|
||||
}
|
||||
else {
|
||||
highlighter = HighlighterFactory.createHighlighter(inputData.getProject(), myFile);
|
||||
highlighter = HighlighterFactory.createHighlighter(inputData.getProject(), inputData.getFile());
|
||||
highlighter.setText(chars);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -78,8 +78,7 @@ public final class TodoIndex extends FileBasedIndexExtension<TodoIndexEntry, Int
|
||||
@NotNull
|
||||
public Map<TodoIndexEntry, Integer> map(@NotNull final FileContent inputData) {
|
||||
final VirtualFile file = inputData.getFile();
|
||||
final DataIndexer<TodoIndexEntry, Integer, FileContent> indexer = PlatformIdTableBuilding
|
||||
.getTodoIndexer(inputData.getFileType(), file);
|
||||
final DataIndexer<TodoIndexEntry, Integer, FileContent> indexer = PlatformIdTableBuilding.getTodoIndexer(inputData.getFileType());
|
||||
if (indexer != null) {
|
||||
return indexer.map(inputData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user