boolean (@NotNull FileViewProvider viewProvider, @NotNull VirtualFile file) { if (!file.isValid()) return false; Map<VirtualFile, FileViewProvider> tempProviders = myTempProviders.get(); if (tempProviders.containsKey(file)) { LOG.error(new StackOverflowPreventedException("isValid leads to endless recursion in " + viewProvider.getClass() + ": " + new ArrayList<>(viewProvider.getLanguages()))); } tempProviders.put(file, null); try { FileViewProvider recreated = createFileViewProvider(file, true); tempProviders.put(file, recreated); return areViewProvidersEquivalent(viewProvider, recreated) && ContainerUtil.all(((AbstractFileViewProvider)viewProvider).getCachedPsiFiles(), FileManagerImpl::isValidOriginal); } finally { FileViewProvider temp = tempProviders.remove(file); if (temp != null) { DebugUtil.performPsiModification("invalidate temp view provider", ((AbstractFileViewProvider)temp)::markInvalidated); } } }