ContextProvider (PsiFile psiFile) { ContextProvider provider = psiFile.getCopyableUserData(KEY); if (provider != null && provider.isValid()) { return provider; } final PsiElement context = psiFile.getContext(); if (context != null) { provider = context.getCopyableUserData(KEY); if (provider != null && provider.isValid()) { return provider; } } return getFromExtensionOrDefault(psiFile); }