AstLoadingFilter: allow enabling loading for a file before disabling it

This commit is contained in:
Daniil Ovchinnikov
2018-04-05 15:03:30 +02:00
parent b946535262
commit 3d1ac364f4
2 changed files with 0 additions and 19 deletions
@@ -144,9 +144,6 @@ public class AstLoadingFilter {
public static <T, E extends Throwable>
T forceEnableTreeLoading(@NotNull VirtualFile virtualFile, @NotNull ThrowableComputable<T, E> computable) throws E {
if (myDisabledInfo.get() == null) {
throw new IllegalStateException("It's not allowed to force enable loading before it has been disabled");
}
Set<VirtualFile> enabledFiles = myForcedEnabledFiles.get();
if (enabledFiles.add(virtualFile)) {
try {
@@ -89,20 +89,4 @@ public class AstLoadingFilterTest extends LightPlatformCodeInsightFixtureTestCas
)
));
}
public void testForceEnableLoadingBeforeDisabling() throws Throwable {
PsiFileImpl file = addFile();
assertFalse(file.isContentsLoaded());
assertException(new AbstractExceptionCase<IllegalStateException>() {
@Override
public Class<IllegalStateException> getExpectedExceptionClass() {
return IllegalStateException.class;
}
@Override
public void tryClosure() throws IllegalStateException {
forceEnableTreeLoading(file, () -> file.getNode());
}
});
}
}