本文整理汇总了Java中consulo.lang.LanguageVersion.getLanguage方法的典型用法代码示例。如果您正苦于以下问题:Java LanguageVersion.getLanguage方法的具体用法?Java LanguageVersion.getLanguage怎么用?Java LanguageVersion.getLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类consulo.lang.LanguageVersion
的用法示例。
在下文中一共展示了LanguageVersion.getLanguage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFileFromText
import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
@Nullable
@Override
public PsiFile createFileFromText(@Nonnull String name,
@Nonnull LanguageVersion languageVersion,
@Nonnull CharSequence text,
boolean physical,
boolean markAsCopy,
boolean noSizeLimit,
@Nullable VirtualFile original) {
LightVirtualFile virtualFile = new LightVirtualFile(name, languageVersion.getLanguage(), text);
if (original != null) virtualFile.setOriginalFile(original);
virtualFile.putUserData(LanguageVersion.KEY, languageVersion);
if (noSizeLimit) {
SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile);
}
return trySetupPsiForFile(virtualFile, languageVersion.getLanguage(), languageVersion, physical, markAsCopy);
}
示例2: isCommentToken
import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
public static boolean isCommentToken(@Nonnull IElementType tokenType, @Nonnull LanguageVersion languageVersion) {
final Language language = tokenType.getLanguage();
if(language != languageVersion.getLanguage()) {
return false;
}
final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(language);
if (parserDefinition != null) {
final TokenSet commentTokens = parserDefinition.getCommentTokens(languageVersion);
if (commentTokens.contains(tokenType)) {
return true;
}
}
return false;
}
示例3: startInjecting
import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
@Nonnull
@Override
public MultiHostRegistrar startInjecting(@Nonnull LanguageVersion languageVersion) {
placeInfos = new SmartList<>();
if (!cleared) {
clear();
throw new IllegalStateException("Seems you haven't called doneInjecting()");
}
currentThread = Thread.currentThread();
if (LanguageParserDefinitions.INSTANCE.forLanguage(languageVersion.getLanguage()) == null) {
throw new UnsupportedOperationException("Cannot inject language '" + languageVersion.getLanguage() + "' because it has no ParserDefinition");
}
myLanguageVersion = languageVersion;
return this;
}
示例4: exceptionContext
import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
@NonNls
private static String exceptionContext(@NonNls @Nonnull String msg,
@Nonnull LanguageVersion languageVersion,
@Nonnull PsiFile hostPsiFile,
@Nonnull VirtualFile hostVirtualFile,
@Nonnull DocumentEx hostDocument,
@Nonnull List<PlaceInfo> placeInfos) {
return msg +
".\n" +
"OK let's see. Host file: " +
hostPsiFile +
" in '" +
hostVirtualFile.getPresentableUrl() +
"' (" +
hostPsiFile.getLanguage() +
") " +
(PsiDocumentManager.getInstance(hostPsiFile.getProject()).isUncommited(hostDocument) ? " (uncommitted)" : "") +
"\n" +
"Was injected " +
languageVersion.getLanguage() +
" at ranges: " +
placeInfos;
}
示例5: injectReference
import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
void injectReference(@Nonnull LanguageVersion languageVersion, @Nonnull String prefix, @Nonnull String suffix, @Nonnull PsiLanguageInjectionHost host, @Nonnull TextRange rangeInsideHost) {
ParserDefinition parser = LanguageParserDefinitions.INSTANCE.forLanguage(languageVersion.getLanguage());
if (parser != null) {
throw new IllegalArgumentException("Language " + languageVersion.getLanguage() + " being injected as reference must not have ParserDefinition and yet - " + parser);
}
ReferenceInjector injector = ReferenceInjector.findById(languageVersion.getLanguage().getID());
if (injector == null) {
throw new IllegalArgumentException("Language " + languageVersion.getLanguage() + " being injected as reference must register reference injector");
}
placeInfos = new SmartList<>();
if (!cleared) {
clear();
throw new IllegalStateException("Seems you haven't called doneInjecting()");
}
myLanguageVersion = languageVersion;
currentThread = Thread.currentThread();
addPlace(prefix, suffix, host, rangeInsideHost);
Place place = new Place();
StringBuilder decodedChars = new StringBuilder();
ShredImpl shred = createShred(placeInfos.get(0), decodedChars, myHostPsiFile);
place.add(shred);
if (resultReferences == null) {
resultReferences = new SmartList<>();
}
resultReferences.add(Pair.create(injector, place));
clear();
}
示例6: isMyVersion
import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
default boolean isMyVersion(@NotNull LanguageVersion languageVersion)
{
return getElementType().getLanguage() == languageVersion.getLanguage();
}