Fix tests: prebuilt aware id indexer can be also lexing indexer

This commit is contained in:
Dmitry Trofimov
2017-10-10 00:21:55 +02:00
parent db70ebfdce
commit d484054fe7
4 changed files with 15 additions and 6 deletions
@@ -19,7 +19,7 @@ import com.intellij.lexer.Lexer;
import com.intellij.openapi.util.Key;
import com.intellij.psi.impl.cache.impl.id.IdIndexEntry;
import com.intellij.psi.impl.cache.impl.id.IdTableBuilding;
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
import com.intellij.psi.impl.cache.impl.id.LexingIdIndexer;
import com.intellij.psi.impl.cache.impl.todo.TodoIndexEntry;
import com.intellij.psi.search.IndexPattern;
import com.intellij.util.indexing.FileContent;
@@ -40,7 +40,7 @@ public class BaseFilterLexerUtil {
}
final boolean needTodo = content.getFile().isInLocalFileSystem(); // same as TodoIndex.getFilter().isAcceptable
final boolean needIdIndex = IdTableBuilding.getFileTypeIndexer(content.getFileType()) instanceof LexerBasedIdIndexer;
final boolean needIdIndex = IdTableBuilding.getFileTypeIndexer(content.getFileType()) instanceof LexingIdIndexer;
final IdDataConsumer consumer = needIdIndex? new IdDataConsumer():null;
final OccurrenceConsumer todoOccurrenceConsumer = new OccurrenceConsumer(consumer, needTodo);
@@ -27,8 +27,7 @@ import java.util.Map;
* @author Eugene Zhuravlev
* Date: Jan 20, 2008
*/
public abstract class LexerBasedIdIndexer extends FileTypeIdIndexer implements IdAndToDoScannerBasedOnFilterLexer {
public abstract class LexerBasedIdIndexer implements LexingIdIndexer, IdAndToDoScannerBasedOnFilterLexer {
@Override
@NotNull
public final Map<IdIndexEntry,Integer> map(@NotNull final FileContent inputData) {
@@ -0,0 +1,10 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl.cache.impl.id;
/**
* @author traff
* <p>
* Marker interface that defines lexer that performes lexing to get Id index map
*/
public interface LexingIdIndexer extends IdIndexer {
}
@@ -3,7 +3,7 @@ package com.intellij.index
import com.intellij.openapi.diagnostic.Logger
import com.intellij.psi.impl.cache.impl.id.IdIndexEntry
import com.intellij.psi.impl.cache.impl.id.IdIndexer
import com.intellij.psi.impl.cache.impl.id.LexingIdIndexer
import com.intellij.util.indexing.FileContent
import com.intellij.util.indexing.impl.DebugAssertions
import com.intellij.util.io.DataExternalizer
@@ -15,7 +15,7 @@ import java.io.DataOutput
* @author traff
*/
abstract class PrebuiltIndexAwareIdIndexer : PrebuiltIndexProviderBase<Map<IdIndexEntry, Int>>(), IdIndexer {
abstract class PrebuiltIndexAwareIdIndexer : PrebuiltIndexProviderBase<Map<IdIndexEntry, Int>>(), LexingIdIndexer {
companion object {
private val LOG = Logger.getInstance("#com.intellij.index.PrebuiltIndexAwareIdIndexer")
val ID_INDEX_FILE_NAME = "id-index"