diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java b/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java index 0ea549c60cd9..e753e3d12bef 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java @@ -120,7 +120,8 @@ public class JsonCachedValues { @Nullable static String fetchSchemaId(@NotNull PsiFile psiFile) { - final JsonObject topLevelValue = ObjectUtils.tryCast(((JsonFile)psiFile).getTopLevelValue(), JsonObject.class); + final JsonObject topLevelValue = AstLoadingFilter + .forceAllowTreeLoading(psiFile, () ->ObjectUtils.tryCast(((JsonFile)psiFile).getTopLevelValue(), JsonObject.class)); return topLevelValue == null ? null : readId(topLevelValue); } diff --git a/plugins/editorconfig/src/org/editorconfig/language/util/headers/EditorConfigHeaderOverrideSearcherBase.kt b/plugins/editorconfig/src/org/editorconfig/language/util/headers/EditorConfigHeaderOverrideSearcherBase.kt index 791c8e3d2fbc..1c1c39c82904 100644 --- a/plugins/editorconfig/src/org/editorconfig/language/util/headers/EditorConfigHeaderOverrideSearcherBase.kt +++ b/plugins/editorconfig/src/org/editorconfig/language/util/headers/EditorConfigHeaderOverrideSearcherBase.kt @@ -1,6 +1,7 @@ // Copyright 2000-2018 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 org.editorconfig.language.util.headers +import com.intellij.util.AstLoadingFilter import org.editorconfig.language.psi.EditorConfigHeader import org.editorconfig.language.psi.EditorConfigPsiFile import org.editorconfig.language.psi.EditorConfigSection @@ -27,7 +28,7 @@ abstract class EditorConfigHeaderOverrideSearcherBase { val currentFile = EditorConfigPsiTreeUtil.getOriginalFile(header.containingFile) as? EditorConfigPsiFile ?: return emptySequence() return findRelevantPsiFiles(currentFile) - .map(EditorConfigPsiFile::sections) + .map { AstLoadingFilter.forceAllowTreeLoading, RuntimeException>(it) { it.sections } } .flatMap(List::asSequence) .map(EditorConfigSection::getHeader) .filter(EditorConfigHeader::isValidGlob) diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java index abdfb18f0fc8..91f03f1d97e7 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java @@ -28,6 +28,7 @@ import com.intellij.psi.util.*; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlTag; import com.intellij.util.ArrayUtil; +import com.intellij.util.AstLoadingFilter; import com.intellij.xml.XmlAttributeDescriptor; import com.intellij.xml.XmlElementDescriptor; import com.intellij.xml.XmlElementsGroup; @@ -271,6 +272,11 @@ public class RngElementDescriptor implements XmlElementDescriptor { return decl; } + return AstLoadingFilter.forceAllowTreeLoading(file, () -> getDeclarationImpl(project, decl, location, file)); + } + + @Nullable + private static PsiElement getDeclarationImpl(@NotNull Project project, PsiElement decl, Locator location, PsiFile file) { final int column = location.getColumnNumber(); final int line = location.getLineNumber(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java index 0a967084c240..bb036f47e4da 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java @@ -462,7 +462,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag, HintedReferenc if (file == null) { return namespace.equals(XmlUtil.getTargetSchemaNsFromTag(this)) ? this : null; } - return file.getDocument(); + return AstLoadingFilter.forceAllowTreeLoading(file, () -> file.getDocument()); } @Override