use of org.intellij.plugins.intelliLang.inject.TemporaryPlacesRegistry in project intellij-community by JetBrains.
the class PyTemporaryInjector method getInjectedLanguage.
@Nullable
@Override
public Language getInjectedLanguage(@NotNull PsiElement context) {
final TemporaryPlacesRegistry registry = TemporaryPlacesRegistry.getInstance(context.getProject());
if (context instanceof PsiLanguageInjectionHost) {
final PsiFile file = context.getContainingFile();
final InjectedLanguage injectedLanguage = registry.getLanguageFor((PsiLanguageInjectionHost) context, file);
if (injectedLanguage != null) {
return injectedLanguage.getLanguage();
}
}
return null;
}
use of org.intellij.plugins.intelliLang.inject.TemporaryPlacesRegistry in project intellij-community by JetBrains.
the class PyTemporaryInjector method getLanguagesToInject.
@Override
public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) {
final PyInjectionUtil.InjectionResult result = registerInjection(registrar, context);
if (result.isInjected()) {
final TemporaryPlacesRegistry registry = TemporaryPlacesRegistry.getInstance(context.getProject());
InjectorUtils.registerSupport(registry.getLanguageInjectionSupport(), false, registrar);
if (!result.isStrict()) {
InjectorUtils.putInjectedFileUserData(registrar, InjectedLanguageUtil.FRANKENSTEIN_INJECTION, Boolean.TRUE);
}
}
}
use of org.intellij.plugins.intelliLang.inject.TemporaryPlacesRegistry in project intellij-plugins by JetBrains.
the class CodeFenceTemporaryLangInjector method findLangForInjection.
@Nullable
@Override
protected Language findLangForInjection(@NotNull MarkdownCodeFenceImpl element) {
final TemporaryPlacesRegistry registry = TemporaryPlacesRegistry.getInstance(element.getProject());
final InjectedLanguage language = registry.getLanguageFor(element, element.getContainingFile());
if (language != null) {
return language.getLanguage();
}
return null;
}
Aggregations