当前位置: 首页>>代码示例>>Java>>正文


Java LanguageVersion.getLanguage方法代码示例

本文整理汇总了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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PsiFileFactoryImpl.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:CommentUtilCore.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:InjectionRegistrarImpl.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:InjectionRegistrarImpl.java

示例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();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:31,代码来源:InjectionRegistrarImpl.java

示例6: isMyVersion

import consulo.lang.LanguageVersion; //导入方法依赖的package包/类
default boolean isMyVersion(@NotNull LanguageVersion languageVersion)
{
	return getElementType().getLanguage() == languageVersion.getLanguage();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:5,代码来源:EmbeddedTokenTypesProvider.java


注:本文中的consulo.lang.LanguageVersion.getLanguage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。