Language (@NotNull PsiElement element) { PsiFile file = element.getContainingFile(); if (file != null) { Language language = file.getLanguage(); if (language instanceof JsonLanguage) return language; } return ObjectUtils.coalesce(ObjectUtils.tryCast(element.getLanguage(), JsonLanguage.class), JsonLanguage.INSTANCE); }