From 4b12ff67d90890fdfc8f0fecd8da73cf35b3af70 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Tue, 17 Dec 2019 11:01:57 +0300 Subject: [PATCH] todo index: get rid of file field in TokenSetTodoIndexer GitOrigin-RevId: 582f0832ff44317e3120aafd9edad9c43c57bee3 --- .../impl/cache/impl/id/PlatformIdTableBuilding.java | 13 +++++-------- .../psi/impl/cache/impl/todo/TodoIndex.java | 3 +-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java index 6eaa92c1a5a7..58ecd8fcdde5 100644 --- a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java +++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java @@ -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 getTodoIndexer(FileType fileType, final VirtualFile virtualFile) { + public static DataIndexer getTodoIndexer(FileType fileType) { final DataIndexer 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); } diff --git a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java index 7aa1d0996ac6..a9495c0f4fa5 100644 --- a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java +++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java @@ -78,8 +78,7 @@ public final class TodoIndex extends FileBasedIndexExtension map(@NotNull final FileContent inputData) { final VirtualFile file = inputData.getFile(); - final DataIndexer indexer = PlatformIdTableBuilding - .getTodoIndexer(inputData.getFileType(), file); + final DataIndexer indexer = PlatformIdTableBuilding.getTodoIndexer(inputData.getFileType()); if (indexer != null) { return indexer.map(inputData); }