當前位置: 首頁>>代碼示例>>Java>>正文


Java Language.getBaseLanguage方法代碼示例

本文整理匯總了Java中com.intellij.lang.Language.getBaseLanguage方法的典型用法代碼示例。如果您正苦於以下問題:Java Language.getBaseLanguage方法的具體用法?Java Language.getBaseLanguage怎麽用?Java Language.getBaseLanguage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.Language的用法示例。


在下文中一共展示了Language.getBaseLanguage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: forLanguage

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Override
public FoldingBuilder forLanguage(@NotNull Language l) {
  FoldingBuilder cached = l.getUserData(getLanguageCache());
  if (cached != null) return cached;

  List<FoldingBuilder> extensions = forKey(l);
  FoldingBuilder result;
  if (extensions.isEmpty()) {

    Language base = l.getBaseLanguage();
    if (base != null) {
      result = forLanguage(base);
    }
    else {
      result = getDefaultImplementation();
    }
  }
  else {
    return extensions.size() == 1 ? extensions.get(0) : new CompositeFoldingBuilder(extensions);
  }

  l.putUserData(getLanguageCache(), result);
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:LanguageFolding.java

示例2: getCommenter

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
public static Commenter getCommenter(final PsiFile file, final Editor editor,
                                     final Language lineStartLanguage, final Language lineEndLanguage) {

  final FileViewProvider viewProvider = file.getViewProvider();

  for (MultipleLangCommentProvider provider : MultipleLangCommentProvider.EP_NAME.getExtensions()) {
    if (provider.canProcess(file, viewProvider)) {
      return provider.getLineCommenter(file, editor, lineStartLanguage, lineEndLanguage);
    }
  }

  final Language fileLanguage = file.getLanguage();
  Language lang = lineStartLanguage == null || LanguageCommenters.INSTANCE.forLanguage(lineStartLanguage) == null ||
                  fileLanguage.getBaseLanguage() == lineStartLanguage // file language is a more specific dialect of the line language
                  ? fileLanguage
                  : lineStartLanguage;

  if (viewProvider instanceof TemplateLanguageFileViewProvider &&
      lang == ((TemplateLanguageFileViewProvider)viewProvider).getTemplateDataLanguage()) {
    lang = viewProvider.getBaseLanguage();
  }

  return LanguageCommenters.INSTANCE.forLanguage(lang);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:CommentByBlockCommentHandler.java

示例3: buildExtensions

import com.intellij.lang.Language; //導入方法依賴的package包/類
@NotNull
@Override
protected List<CompletionContributor> buildExtensions(@NotNull String stringKey, @NotNull Language key) {
  Set<String> allowed = new THashSet<String>();
  while (key != null) {
    allowed.add(keyToString(key));
    key = key.getBaseLanguage();
  }
  allowed.add("any");
  return buildExtensions(allowed);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:CompletionContributor.java

示例4: getCommonSettings

import com.intellij.lang.Language; //導入方法依賴的package包/類
/**
 * Attempts to get language-specific common settings from <code>LanguageCodeStyleSettingsProvider</code>.
 *
 * @param lang The language to get settings for.
 * @return If the provider for the language exists and is able to create language-specific default settings
 *         (<code>LanguageCodeStyleSettingsProvider.getDefaultCommonSettings()</code> doesn't return null)
 *         returns the instance of settings for this language. Otherwise returns the instance of parent settings
 *         shared between several languages.
 */
public CommonCodeStyleSettings getCommonSettings(@Nullable Language lang) {
  Map<Language, CommonCodeStyleSettings> commonSettingsMap = getCommonSettingsMap();
  CommonCodeStyleSettings settings = commonSettingsMap.get(lang);
  while (settings == null && lang != null) {
    lang = lang.getBaseLanguage();
    settings = commonSettingsMap.get(lang);
  }
  if (settings != null) {
    return settings;
  }
  return myParentSettings;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:CommonCodeStyleSettingsManager.java

示例5: supportsXmlTypedHandlers

import com.intellij.lang.Language; //導入方法依賴的package包/類
public static boolean supportsXmlTypedHandlers(PsiFile file) {
  Language language = file.getLanguage();
  while (language != null) {
    if ("JavaScript".equals(language.getID())) return true;
    language = language.getBaseLanguage();
  }

  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:HtmlUtil.java


注:本文中的com.intellij.lang.Language.getBaseLanguage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。