mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-23750 turn language trackers on
This commit is contained in:
@@ -31,12 +31,14 @@ import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.containers.ConcurrentFactoryMap;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.psi.impl.PsiTreeChangeEventImpl.PsiEventType.CHILD_MOVED;
|
||||
import static com.intellij.psi.impl.PsiTreeChangeEventImpl.PsiEventType.PROPERTY_CHANGED;
|
||||
@@ -124,16 +126,18 @@ public class PsiModificationTrackerImpl implements PsiModificationTracker, PsiTr
|
||||
protected void incLanguageTrackers(@NotNull PsiTreeChangeEventImpl event) {
|
||||
if (!ourEnableLanguageTracker.asBoolean()) return;
|
||||
incLanguageModificationCount(Language.ANY);
|
||||
for (PsiElement o : new PsiElement[]{
|
||||
PsiElement[] elements = {
|
||||
event.getFile(), event.getParent(), event.getOldParent(), event.getNewParent(),
|
||||
event.getElement(), event.getChild(), event.getOldChild(), event.getNewChild()
|
||||
}) {
|
||||
event.getElement(), event.getChild(), event.getOldChild(), event.getNewChild()};
|
||||
Set<Language> languages = ContainerUtil.newHashSet(elements.length);
|
||||
languages.add(Language.ANY);
|
||||
for (PsiElement o : elements) {
|
||||
PsiFile file = o instanceof PsiFile ? (PsiFile)o : null;
|
||||
if (file == null) {
|
||||
try {
|
||||
IElementType type = PsiUtilCore.getElementType(o);
|
||||
Language language = type != null ? type.getLanguage() : o != null ? o.getLanguage() : null;
|
||||
incLanguageModificationCount(language);
|
||||
ContainerUtil.addIfNotNull(languages, language);
|
||||
}
|
||||
catch (PsiInvalidElementAccessException e) {
|
||||
PsiDocumentManagerBase.LOG.warn(e);
|
||||
@@ -141,10 +145,13 @@ public class PsiModificationTrackerImpl implements PsiModificationTracker, PsiTr
|
||||
}
|
||||
else {
|
||||
for (Language language : file.getViewProvider().getLanguages()) {
|
||||
incLanguageModificationCount(language);
|
||||
ContainerUtil.addIfNotNull(languages, language);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Language language : languages) {
|
||||
incLanguageModificationCount(language);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -527,7 +527,7 @@ psi.modification.tracker.code-block=false
|
||||
psi.modification.tracker.code-block.description=Controls out-of-code-block PSI modification tracker optimization
|
||||
psi.modification.tracker.java-structure=false
|
||||
psi.modification.tracker.java-structure.description=Controls java-structure PSI modification tracker optimization
|
||||
psi.modification.tracker.per-language=false
|
||||
psi.modification.tracker.per-language=true
|
||||
psi.modification.tracker.per-language.description=Controls per-language PSI modification tracker optimization
|
||||
|
||||
ide.suggest.file.when.creating.filename.like.directory=true
|
||||
|
||||
Reference in New Issue
Block a user