com.intellij.lang.annotation.Annotator Java Examples

The following examples show how to use com.intellij.lang.annotation.Annotator. 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: DefaultHighlightVisitor.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void runAnnotators(PsiElement element) {
  List<Annotator> annotators = myCachedAnnotators.get(element.getLanguage().getID());
  if (annotators.isEmpty()) return;
  final boolean dumb = myDumbService.isDumb();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0; i < annotators.size(); i++) {
    Annotator annotator = annotators.get(i);
    if (dumb && !DumbService.isDumbAware(annotator)) {
      continue;
    }

    ProgressManager.checkCanceled();

    annotator.annotate(element, myAnnotationHolder);
  }
}
 
Example #2
Source File: AbstractTestCase.java    From idea-php-typo3-plugin with MIT License 5 votes vote down vote up
@NotNull
private AnnotationHolderImpl getAnnotationsAtCaret(String filename, String content) {
    PsiFile psiFile = myFixture.configureByText(filename, content);
    PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

    AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));

    for (Annotator annotator : LanguageAnnotators.INSTANCE.allForLanguage(psiFile.getLanguage())) {
        annotator.annotate(psiElement, annotations);
    }

    return annotations;
}
 
Example #3
Source File: ShopwareLightCodeInsightFixtureTestCase.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
@NotNull
private AnnotationHolderImpl getAnnotationsAtCaret(String filename, String content) {
    PsiFile psiFile = myFixture.configureByText(filename, content);
    PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

    AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));

    for (Annotator annotator : LanguageAnnotators.INSTANCE.allForLanguage(psiFile.getLanguage())) {
        annotator.annotate(psiElement, annotations);
    }

    return annotations;
}
 
Example #4
Source File: DrupalLightCodeInsightFixtureTestCase.java    From idea-php-drupal-symfony2-bridge with MIT License 5 votes vote down vote up
@NotNull
private AnnotationHolderImpl getAnnotationsAtCaret(String filename, String content) {
    PsiFile psiFile = myFixture.configureByText(filename, content);
    PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

    AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));

    for (Annotator annotator : LanguageAnnotators.INSTANCE.allForLanguage(psiFile.getLanguage())) {
        annotator.annotate(psiElement, annotations);
    }

    return annotations;
}
 
Example #5
Source File: SymfonyLightCodeInsightFixtureTestCase.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
@NotNull
private AnnotationHolderImpl getAnnotationsAtCaret(String filename, String content) {
    PsiFile psiFile = myFixture.configureByText(filename, content);
    PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());

    AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));

    for (Annotator annotator : LanguageAnnotators.INSTANCE.allForLanguage(psiFile.getLanguage())) {
        annotator.annotate(psiElement, annotations);
    }

    return annotations;
}
 
Example #6
Source File: CachedAnnotators.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public Collection<Annotator> initialValue(@Nonnull String languageId) {
  Language language = Language.findLanguageByID(languageId);
  return language == null ? ContainerUtil.<Annotator>emptyList() : LanguageAnnotators.INSTANCE.allForLanguage(language);
}
 
Example #7
Source File: CachedAnnotators.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
List<Annotator> get(@Nonnull String languageId) {
  return cachedAnnotators.get(languageId);
}