use of com.intellij.psi.injection.ReferenceInjector in project intellij-community by JetBrains.
the class InjectorUtils method getLanguageByString.
@Nullable
public static Language getLanguageByString(String languageId) {
Language language = InjectedLanguage.findLanguageById(languageId);
if (language != null)
return language;
ReferenceInjector injector = ReferenceInjector.findById(languageId);
if (injector != null)
return injector.toLanguage();
FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(languageId);
return fileType instanceof LanguageFileType ? ((LanguageFileType) fileType).getLanguage() : null;
}
use of com.intellij.psi.injection.ReferenceInjector in project intellij-community by JetBrains.
the class MultiHostRegistrarImpl method startInjecting.
@Override
@NotNull
public MultiHostRegistrar startInjecting(@NotNull Language language) {
escapers = new SmartList<>();
shreds = new SmartList<>();
outChars = new StringBuilder();
if (!cleared) {
clear();
throw new IllegalStateException("Seems you haven't called doneInjecting()");
}
if (LanguageParserDefinitions.INSTANCE.forLanguage(language) == null) {
ReferenceInjector injector = ReferenceInjector.findById(language.getID());
if (injector == null) {
throw new UnsupportedOperationException("Cannot inject language '" + language + "' since its getParserDefinition() returns null");
}
myLanguage = null;
myReferenceInjector = injector;
}
myLanguage = language;
//fileExtension = fileType == null ? null : fileType.getDefaultExtension();
return this;
}
Aggregations