Language (@NotNull PsiElement context) { if (context instanceof PsiLanguageInjectionHost && context instanceof PyElement) { PsiFile file = context.getContainingFile(); InjectedLanguage injectedLanguage = TemporaryPlacesRegistry.getInstance(file.getProject()) .getLanguageFor((PsiLanguageInjectionHost)context, file); if (injectedLanguage != null) { return injectedLanguage.getLanguage(); } } return null; }