"todo" moved out of lang-impl

This commit is contained in:
Alexey Kudravtsev
2013-09-23 17:48:14 +04:00
parent 97cd63393f
commit f419fab815
34 changed files with 99 additions and 68 deletions
@@ -16,6 +16,7 @@
package com.intellij.lexer;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
public class DummyLexer extends LexerBase {
private CharSequence myBuffer;
@@ -27,43 +28,55 @@ public class DummyLexer extends LexerBase {
myTokenType = type;
}
public void start(final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
@Override
public void start(@NotNull final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
myBuffer = buffer;
myStartOffset = startOffset;
myEndOffset = endOffset;
}
@NotNull
@Override
public CharSequence getBufferSequence() {
return myBuffer;
}
@Override
public int getState() {
return 0;
}
@Override
public IElementType getTokenType() {
return (myStartOffset < myEndOffset ? myTokenType : null);
return myStartOffset < myEndOffset ? myTokenType : null;
}
@Override
public int getTokenStart() {
return myStartOffset;
}
@Override
public int getTokenEnd() {
return myEndOffset;
}
@Override
public void advance() {
myStartOffset = myEndOffset;
}
@NotNull
@Override
public LexerPosition getCurrentPosition() {
return new LexerPositionImpl(0, getState());
}
public void restore(LexerPosition position) {
@Override
public void restore(@NotNull LexerPosition position) {
}
@Override
public int getBufferEnd() {
return myEndOffset;
}
@@ -19,13 +19,14 @@
*/
package com.intellij.openapi.fileTypes;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.KeyedExtensionFactory;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class FileTypeExtensionFactory<T> extends KeyedExtensionFactory<T, FileType> {
public FileTypeExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final String epName) {
super(interfaceClass, epName);
super(interfaceClass, epName, ApplicationManager.getApplication().getPicoContainer());
}
@Override
+1
View File
@@ -11,6 +11,7 @@
<orderEntry type="module" module-name="util" />
<orderEntry type="module" module-name="annotations" />
<orderEntry type="module" module-name="projectModel-api" />
<orderEntry type="module" module-name="indexing-api" />
</component>
</module>
@@ -27,31 +27,38 @@ import org.jetbrains.annotations.NotNull;
public class HighlighterFactory {
private HighlighterFactory() {}
public static EditorHighlighter createHighlighter(SyntaxHighlighter highlighter, EditorColorsScheme settings) {
@NotNull
public static EditorHighlighter createHighlighter(SyntaxHighlighter highlighter, @NotNull EditorColorsScheme settings) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(highlighter, settings);
}
public static EditorHighlighter createHighlighter(Project project, String fileName) {
@NotNull
public static EditorHighlighter createHighlighter(Project project, @NotNull String fileName) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileName);
}
public static EditorHighlighter createHighlighter(Project project, VirtualFile file) {
@NotNull
public static EditorHighlighter createHighlighter(Project project, @NotNull VirtualFile file) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(project, file);
}
public static EditorHighlighter createHighlighter(Project project, FileType fileType) {
@NotNull
public static EditorHighlighter createHighlighter(Project project, @NotNull FileType fileType) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileType);
}
public static EditorHighlighter createHighlighter(EditorColorsScheme settings, String fileName, Project project) {
@NotNull
public static EditorHighlighter createHighlighter(@NotNull EditorColorsScheme settings, @NotNull String fileName, Project project) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(settings, fileName, project);
}
public static EditorHighlighter createHighlighter(FileType fileType, EditorColorsScheme settings, Project project) {
@NotNull
public static EditorHighlighter createHighlighter(@NotNull FileType fileType, @NotNull EditorColorsScheme settings, Project project) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(fileType, settings, project);
}
public static EditorHighlighter createHighlighter(@NotNull VirtualFile vFile, EditorColorsScheme settings, Project project) {
@NotNull
public static EditorHighlighter createHighlighter(@NotNull VirtualFile vFile, @NotNull EditorColorsScheme settings, Project project) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(vFile, settings, project);
}
}
@@ -33,17 +33,24 @@ public abstract class EditorHighlighterFactory {
return ServiceManager.getService(EditorHighlighterFactory.class);
}
public abstract EditorHighlighter createEditorHighlighter(final SyntaxHighlighter syntaxHighlighter, final EditorColorsScheme colors);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(final SyntaxHighlighter syntaxHighlighter, @NotNull EditorColorsScheme colors);
public abstract EditorHighlighter createEditorHighlighter(final FileType fileType, final EditorColorsScheme settings, final Project project);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(@NotNull FileType fileType, @NotNull EditorColorsScheme settings, final Project project);
public abstract EditorHighlighter createEditorHighlighter(final Project project, final FileType fileType);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(final Project project, @NotNull FileType fileType);
public abstract EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile file, final EditorColorsScheme globalScheme, @Nullable final Project project);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile file, @NotNull EditorColorsScheme globalScheme, @Nullable final Project project);
public abstract EditorHighlighter createEditorHighlighter(final Project project, final VirtualFile file);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(final Project project, @NotNull VirtualFile file);
public abstract EditorHighlighter createEditorHighlighter(final Project project, final String fileName);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(final Project project, @NotNull String fileName);
public abstract EditorHighlighter createEditorHighlighter(final EditorColorsScheme settings, final String fileName, @Nullable final Project project);
@NotNull
public abstract EditorHighlighter createEditorHighlighter(@NotNull EditorColorsScheme settings, @NotNull String fileName, @Nullable final Project project);
}
@@ -23,13 +23,15 @@ import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
public class PlainSyntaxHighlighter implements SyntaxHighlighter {
private static final TextAttributesKey[] ATTRS = new TextAttributesKey[] {HighlighterColors.TEXT};
private static final TextAttributesKey[] ATTRS = {HighlighterColors.TEXT};
@Override
@NotNull
public Lexer getHighlightingLexer() {
return new EmptyLexer();
}
@Override
@NotNull
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
return ATTRS;
@@ -28,4 +28,4 @@ public class PlainSyntaxHighlighterFactory extends SyntaxHighlighterFactory {
public SyntaxHighlighter getSyntaxHighlighter(final Project project, final VirtualFile virtualFile) {
return new PlainSyntaxHighlighter();
}
}
}
@@ -53,4 +53,4 @@ public interface SyntaxHighlighter {
*/
@NotNull
TextAttributesKey[] getTokenHighlights(IElementType tokenType);
}
}
@@ -50,7 +50,7 @@ public abstract class SyntaxHighlighterFactory {
* @return {@code SyntaxHighlighter} interface implementation for the given file type
*/
@Nullable
public static SyntaxHighlighter getSyntaxHighlighter(FileType fileType, @Nullable Project project, @Nullable VirtualFile file) {
public static SyntaxHighlighter getSyntaxHighlighter(@NotNull FileType fileType, @Nullable Project project, @Nullable VirtualFile file) {
return SyntaxHighlighter.PROVIDER.create(fileType, project, file);
}
@@ -25,4 +25,4 @@ public class SyntaxHighlighterLanguageFactory extends LanguageExtension<SyntaxHi
SyntaxHighlighterLanguageFactory() {
super("com.intellij.lang.syntaxHighlighterFactory", new PlainSyntaxHighlighterFactory());
}
}
}
@@ -24,9 +24,10 @@ package com.intellij.openapi.fileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface SyntaxHighlighterProvider {
@Nullable
SyntaxHighlighter create(FileType fileType, @Nullable Project project, @Nullable VirtualFile file);
SyntaxHighlighter create(@NotNull FileType fileType, @Nullable Project project, @Nullable VirtualFile file);
}
+2
View File
@@ -11,6 +11,8 @@
<orderEntry type="module" module-name="util" exported="" />
<orderEntry type="module" module-name="annotations" exported="" />
<orderEntry type="module" module-name="core-impl" exported="" />
<orderEntry type="module" module-name="indexing-impl" />
<orderEntry type="module" module-name="projectModel-api" />
</component>
</module>
@@ -23,11 +23,9 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.fileTypes.*;
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.impl.BaseFilterLexer;
@@ -41,7 +39,6 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.DataIndexer;
import com.intellij.util.indexing.FileBasedIndexImpl;
import com.intellij.util.indexing.FileContent;
import com.intellij.util.indexing.SubstitutedFileType;
import org.jetbrains.annotations.NotNull;
@@ -57,10 +54,9 @@ import java.util.regex.Pattern;
* Author: dmitrylomov
*/
public abstract class PlatformIdTableBuilding {
static final HashMap<FileType, DataIndexer<TodoIndexEntry, Integer, FileContent>> ourTodoIndexers =
new HashMap<FileType, DataIndexer<TodoIndexEntry, Integer, FileContent>>();
private static final TokenSet ABSTRACT_FILE_COMMENT_TOKENS =
TokenSet.create(CustomHighlighterTokenType.LINE_COMMENT, CustomHighlighterTokenType.MULTI_LINE_COMMENT);
public static final Key<EditorHighlighter> EDITOR_HIGHLIGHTER = new Key<EditorHighlighter>("Editor");
private static final Map<FileType, DataIndexer<TodoIndexEntry, Integer, FileContent>> ourTodoIndexers = new HashMap<FileType, DataIndexer<TodoIndexEntry, Integer, FileContent>>();
private static final TokenSet ABSTRACT_FILE_COMMENT_TOKENS = TokenSet.create(CustomHighlighterTokenType.LINE_COMMENT, CustomHighlighterTokenType.MULTI_LINE_COMMENT);
private PlatformIdTableBuilding() {}
@@ -112,19 +108,18 @@ public abstract class PlatformIdTableBuilding {
}
@Deprecated
public static void registerTodoIndexer(FileType fileType, DataIndexer<TodoIndexEntry, Integer, FileContent> indexer) {
public static void registerTodoIndexer(@NotNull FileType fileType, DataIndexer<TodoIndexEntry, Integer, FileContent> indexer) {
ourTodoIndexers.put(fileType, indexer);
}
public static boolean isTodoIndexerRegistered(FileType fileType) {
return ourTodoIndexers.containsKey(fileType) || TodoIndexers.INSTANCE.forFileType(fileType) != null;
public static boolean isTodoIndexerRegistered(@NotNull FileType fileType) {
return ourTodoIndexers.containsKey(fileType) || TodoIndexers.INSTANCE.forFileType(fileType) != null || fileType instanceof InternalFileType;
}
private static class CompositeTodoIndexer implements DataIndexer<TodoIndexEntry, Integer, FileContent> {
private final DataIndexer<TodoIndexEntry, Integer, FileContent>[] indexers;
public CompositeTodoIndexer(DataIndexer<TodoIndexEntry, Integer, FileContent>... indexers) {
public CompositeTodoIndexer(@NotNull DataIndexer<TodoIndexEntry, Integer, FileContent>... indexers) {
this.indexers = indexers;
}
@@ -163,7 +158,7 @@ public abstract class PlatformIdTableBuilding {
final OccurrenceConsumer occurrenceConsumer = new OccurrenceConsumer(null, true);
EditorHighlighter highlighter;
final EditorHighlighter editorHighlighter = inputData.getUserData(FileBasedIndexImpl.EDITOR_HIGHLIGHTER);
final EditorHighlighter editorHighlighter = inputData.getUserData(EDITOR_HIGHLIGHTER);
if (editorHighlighter != null && checkCanUseCachedEditorHighlighter(chars, editorHighlighter)) {
highlighter = editorHighlighter;
}
@@ -241,15 +236,15 @@ public abstract class PlatformIdTableBuilding {
}
static {
IdTableBuilding.registerIdIndexer(FileTypes.PLAIN_TEXT, new IdTableBuilding.PlainTextIndexer());
registerTodoIndexer(FileTypes.PLAIN_TEXT, new PlainTextTodoIndexer());
IdTableBuilding.registerIdIndexer(PlainTextFileType.INSTANCE, new IdTableBuilding.PlainTextIndexer());
registerTodoIndexer(PlainTextFileType.INSTANCE, new PlainTextTodoIndexer());
IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_MODULE, null);
IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_WORKSPACE, null);
IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_PROJECT, null);
//IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_MODULE, null);
//IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_WORKSPACE, null);
//IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_PROJECT, null);
registerTodoIndexer(StdFileTypes.IDEA_MODULE, null);
registerTodoIndexer(StdFileTypes.IDEA_WORKSPACE, null);
registerTodoIndexer(StdFileTypes.IDEA_PROJECT, null);
//registerTodoIndexer(StdFileTypes.IDEA_MODULE, null);
//registerTodoIndexer(StdFileTypes.IDEA_WORKSPACE, null);
//registerTodoIndexer(StdFileTypes.IDEA_PROJECT, null);
}
}
@@ -22,8 +22,6 @@ import com.intellij.lang.ParserDefinition;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.openapi.project.ProjectCoreUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding;
import com.intellij.psi.search.IndexPatternProvider;
@@ -113,7 +111,7 @@ public class TodoIndex extends FileBasedIndexExtension<TodoIndexEntry, Integer>
private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(final VirtualFile file) {
if (!(file.getFileSystem() instanceof LocalFileSystem)) {
if (!file.isInLocalFileSystem()) {
return false; // do not index TODOs in library sources
}
@@ -15,12 +15,12 @@
*/
package com.intellij.openapi.util;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.KeyedFactoryEPBean;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.picocontainer.PicoContainer;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
@@ -32,10 +32,12 @@ import java.lang.reflect.Proxy;
public abstract class KeyedExtensionFactory<T, KeyT> {
private final Class<T> myInterfaceClass;
private final ExtensionPointName<KeyedFactoryEPBean> myEpName;
private final PicoContainer myPicoContainer;
public KeyedExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final String epName) {
public KeyedExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final String epName, @NotNull PicoContainer picoContainer) {
myInterfaceClass = interfaceClass;
myEpName = new ExtensionPointName<KeyedFactoryEPBean>(epName);
myPicoContainer = picoContainer;
}
@NotNull
@@ -63,7 +65,7 @@ public abstract class KeyedExtensionFactory<T, KeyT> {
if (Comparing.strEqual(getKey(key), epBean.key)) {
try {
if (epBean.implementationClass != null) {
return (T)epBean.instantiate(epBean.implementationClass, ApplicationManager.getApplication().getPicoContainer());
return (T)epBean.instantiate(epBean.implementationClass, myPicoContainer);
}
}
catch (Exception e) {
@@ -80,10 +82,10 @@ public abstract class KeyedExtensionFactory<T, KeyT> {
if (Comparing.strEqual(epBean.key, key, true)) {
try {
if (epBean.implementationClass != null) {
result = epBean.instantiate(epBean.implementationClass, ApplicationManager.getApplication().getPicoContainer());
result = epBean.instantiate(epBean.implementationClass, myPicoContainer);
}
else {
Object factory = epBean.instantiate(epBean.factoryClass, ApplicationManager.getApplication().getPicoContainer());
Object factory = epBean.instantiate(epBean.factoryClass, myPicoContainer);
result = method.invoke(factory, args);
}
if (result != null) {
@@ -22,6 +22,7 @@ import com.intellij.lang.cacheBuilder.*;
import com.intellij.lang.findUsages.FindUsagesProvider;
import com.intellij.lang.findUsages.LanguageFindUsages;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.InternalFileType;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.psi.CustomHighlighterTokenType;
@@ -65,15 +66,15 @@ public class IdTableBuilding {
}
}
private static final HashMap<FileType, FileTypeIdIndexer> ourIdIndexers = new HashMap<FileType, FileTypeIdIndexer>();
private static final Map<FileType, FileTypeIdIndexer> ourIdIndexers = new HashMap<FileType, FileTypeIdIndexer>();
@Deprecated
public static void registerIdIndexer(FileType fileType, FileTypeIdIndexer indexer) {
public static void registerIdIndexer(@NotNull FileType fileType, FileTypeIdIndexer indexer) {
ourIdIndexers.put(fileType, indexer);
}
public static boolean isIdIndexerRegistered(FileType fileType) {
return ourIdIndexers.containsKey(fileType) || IdIndexers.INSTANCE.forFileType(fileType) != null;
public static boolean isIdIndexerRegistered(@NotNull FileType fileType) {
return ourIdIndexers.containsKey(fileType) || IdIndexers.INSTANCE.forFileType(fileType) != null || fileType instanceof InternalFileType;
}
@@ -21,6 +21,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiFile;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -30,9 +31,9 @@ public interface IndexPatternBuilder {
ExtensionPointName<IndexPatternBuilder> EP_NAME = ExtensionPointName.create("com.intellij.indexPatternBuilder");
@Nullable
Lexer getIndexingLexer(PsiFile file);
Lexer getIndexingLexer(@NotNull PsiFile file);
@Nullable
TokenSet getCommentTokenSet(PsiFile file);
TokenSet getCommentTokenSet(@NotNull PsiFile file);
int getCommentStartDelta(IElementType tokenType);
int getCommentEndDelta(IElementType tokenType);
}
@@ -1,4 +1,3 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
@@ -68,4 +67,4 @@ public class TodoItemImpl implements TodoItem {
myEndOffset == todoItem.myEndOffset &&
myPattern.equals(todoItem.myPattern);
}
}
}
@@ -20,6 +20,7 @@
*/
package com.intellij.openapi.roots.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
import com.intellij.openapi.roots.OrderRootType;
@@ -29,7 +30,9 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public interface OrderRootTypeUIFactory {
KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType> FACTORY = new KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType>(OrderRootTypeUIFactory.class, "com.intellij.OrderRootTypeUI") {
KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType> FACTORY = new KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType>(OrderRootTypeUIFactory.class, "com.intellij.OrderRootTypeUI",
ApplicationManager
.getApplication().getPicoContainer()) {
@Override
public String getKey(@NotNull final OrderRootType key) {
return key.name();
@@ -30,7 +30,6 @@ import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
import com.intellij.openapi.editor.impl.EditorHighlighterCache;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -57,6 +56,7 @@ import com.intellij.openapi.vfs.newvfs.persistent.FlushingDaemon;
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiDocumentTransactionListener;
import com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding;
import com.intellij.psi.impl.source.PsiFileImpl;
import com.intellij.psi.search.EverythingGlobalScope;
import com.intellij.psi.search.GlobalSearchScope;
@@ -1551,7 +1551,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
initFileContent(newFc, project, dominantContentFile);
if (content instanceof AuthenticContent) {
newFc.putUserData(EDITOR_HIGHLIGHTER, EditorHighlighterCache.getEditorHighlighterForCachesBuilding(document));
newFc.putUserData(PlatformIdTableBuilding.EDITOR_HIGHLIGHTER, EditorHighlighterCache.getEditorHighlighterForCachesBuilding(document));
}
final int inputId = Math.abs(getFileId(vFile));
@@ -1571,8 +1571,6 @@ public class FileBasedIndexImpl extends FileBasedIndex {
private final TaskQueue myContentlessIndicesUpdateQueue = new TaskQueue(10000);
public static final Key<EditorHighlighter> EDITOR_HIGHLIGHTER = new Key<EditorHighlighter>("Editor");
@Nullable
private PsiFile findDominantPsiForDocument(@NotNull Document document, @Nullable Project project) {
synchronized (myTransactionMap) {