com.intellij.lang.PairedBraceMatcher Java Examples
The following examples show how to use
com.intellij.lang.PairedBraceMatcher.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CSharpDocBraceMatcher.java From consulo-csharp with Apache License 2.0 | 6 votes |
@Override public IElementType getOppositeBraceTokenType(@Nonnull final IElementType type) { PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(type.getLanguage()); if(matcher != null) { BracePair[] pairs = matcher.getPairs(); for(BracePair pair : pairs) { if(pair.getLeftBraceType() == type) { return pair.getRightBraceType(); } if(pair.getRightBraceType() == type) { return pair.getLeftBraceType(); } } } return null; }
Example #2
Source File: BraceMatchingUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static BraceMatcher getBraceMatcher(@Nonnull FileType fileType, @Nonnull Language lang) { PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(lang); if (matcher != null) { if (matcher instanceof XmlAwareBraceMatcher) { return (XmlAwareBraceMatcher)matcher; } else { return new PairedBraceMatcherAdapter(matcher, lang); } } final BraceMatcher byFileType = getBraceMatcherByFileType(fileType); if (byFileType != null) return byFileType; if (fileType instanceof LanguageFileType) { final Language language = ((LanguageFileType)fileType).getLanguage(); if (lang != language) { final FileType type1 = lang.getAssociatedFileType(); if (type1 != null) { final BraceMatcher braceMatcher = getBraceMatcherByFileType(type1); if (braceMatcher != null) { return braceMatcher; } } matcher = LanguageBraceMatching.INSTANCE.forLanguage(language); if (matcher != null) { return new PairedBraceMatcherAdapter(matcher, language); } } } return BraceMatcherHolder.ourDefaultBraceMatcher; }
Example #3
Source File: PairedBraceMatcherAdapter.java From consulo with Apache License 2.0 | 4 votes |
public PairedBraceMatcherAdapter(final PairedBraceMatcher matcher, Language language) { myMatcher = matcher; myLanguage = language; }