本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}