com.intellij.lang.annotation.AnnotationHolder Java Examples

The following examples show how to use com.intellij.lang.annotation.AnnotationHolder. 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: UnaryOperatorTypeAnnotation.java    From glsl4idea with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void annotate(GLSLUnaryOperatorExpression expr, AnnotationHolder holder) {
    final GLSLExpression operand = expr.getOperand();
    final GLSLOperator operator = expr.getOperator();
    if(operand == null || operator == null)return;

    if(!(operator instanceof GLSLOperator.GLSLUnaryOperator)){
        holder.createErrorAnnotation(expr, '\''+operator.getTextRepresentation()+"' is not an unary operator");
        return;
    }

    GLSLOperator.GLSLUnaryOperator unaryOperator = (GLSLOperator.GLSLUnaryOperator) operator;
    final GLSLType operandType = operand.getType();
    if(operandType.isValidType()){
        if(!unaryOperator.isValidInput(operandType)){
            holder.createErrorAnnotation(expr,
                    "'" + operator.getTextRepresentation() + "' does not operate on '" + operandType.getTypename() + "'");
        }
    }
}
 
Example #2
Source File: AnnotatorUtils.java    From litho with Apache License 2.0 6 votes vote down vote up
static void addError(
    AnnotationHolder holder, SpecModelValidationError error, List<IntentionAction> fixes) {
  PsiElement errorElement = (PsiElement) error.element;
  Annotation errorAnnotation =
      holder.createErrorAnnotation(
          Optional.of(errorElement)
              .filter(element -> element instanceof PsiClass || element instanceof PsiMethod)
              .map(PsiNameIdentifierOwner.class::cast)
              .map(PsiNameIdentifierOwner::getNameIdentifier)
              .orElse(errorElement),
          error.message);
  if (!fixes.isEmpty()) {
    for (IntentionAction fix : fixes) {
      errorAnnotation.registerFix(fix);
    }
  }
}
 
Example #3
Source File: PropertyNotInModelAnnotator.java    From intellij-spring-assistant with MIT License 6 votes vote down vote up
@Override
public void annotate(@NotNull final PsiElement element,
    @NotNull final AnnotationHolder annotationHolder) {
  // TODO: Fix this
  //    final ModelProvider modelProvider = ModelProvider.INSTANCE;
  //    final ResourceTypeKey resourceKey = KubernetesYamlPsiUtil.findResourceKey(element);
  //    if (resourceKey != null && element instanceof YAMLKeyValue) {
  //      final YAMLKeyValue keyValue = (YAMLKeyValue) element;
  //      final Model model = KubernetesYamlPsiUtil.modelForKey(modelProvider, resourceKey, keyValue);
  //      if (keyValue.getValue() instanceof YAMLMapping && model != null) {
  //        final YAMLMapping mapping = (YAMLMapping) keyValue.getValue();
  //        final Set<String> expectedProperties = model.getProperties().keySet();
  //        //noinspection ConstantConditions
  //        mapping.getKeyValues().stream()
  //            .filter(k -> !expectedProperties.contains(k.getKeyText().trim())).forEach(
  //            k -> annotationHolder.createWarningAnnotation(k.getKey(),
  //                "SpringConfigurationMetadataProperty '" + k.getKeyText()
  //                    + "' is not expected here.").registerFix(new DeletePropertyIntentionAction()));
  //      }
  //    }
}
 
Example #4
Source File: BuckAnnotator.java    From buck with Apache License 2.0 6 votes vote down vote up
/** Annotates targets that refer to files relative to this file. */
private boolean annotateStringAsLocalFile(
    BuckSimpleExpression targetExpression,
    String targetValue,
    AnnotationHolder annotationHolder) {
  Optional<VirtualFile> targetFile =
      Optional.of(targetExpression)
          .map(PsiElement::getContainingFile)
          .map(PsiFile::getVirtualFile)
          .map(VirtualFile::getParent)
          .map(dir -> dir.findFileByRelativePath(targetValue))
          .filter(VirtualFile::exists);
  if (!targetFile.isPresent()) {
    return false;
  }
  Annotation annotation =
      annotationHolder.createInfoAnnotation(targetExpression, targetFile.get().getPath());
  annotation.setTextAttributes(BuckSyntaxHighlighter.BUCK_FILE_NAME);
  return true;
}
 
Example #5
Source File: LayoutSpecAnnotator.java    From litho with Apache License 2.0 6 votes vote down vote up
@Override
public void annotate(PsiElement element, AnnotationHolder holder) {
  DEBUG_LOGGER.logStep("start " + element);
  if (!(element instanceof PsiClass)) return;

  final PsiClass cls = (PsiClass) element;
  if (!LithoPluginUtils.isLayoutSpec(cls)) return;

  final List<SpecModelValidationError> errors =
      Optional.ofNullable(ComponentGenerateUtils.createLayoutModel(cls))
          .map(model -> model.validate(RunMode.normal()))
          .orElse(Collections.emptyList());
  if (!errors.isEmpty()) {
    final Map<String, String> data = new HashMap<>();
    data.put(EventLogger.KEY_TYPE, "layout_spec");
    LOGGER.log(EventLogger.EVENT_ANNOTATOR, data);
    errors.forEach(error -> AnnotatorUtils.addError(holder, error));
  }
  DEBUG_LOGGER.logStep("end " + element);
}
 
Example #6
Source File: DuplicateKeyAnnotator.java    From intellij-kubernetes with Apache License 2.0 6 votes vote down vote up
@Override
public void annotate(@NotNull final PsiElement element, @NotNull final AnnotationHolder annotationHolder) {
    if (!KubernetesYamlPsiUtil.isKubernetesFile(element)) {
        return;
    }
    if (element instanceof YAMLMapping) {
        final YAMLMapping mapping = (YAMLMapping) element;
        final Collection<YAMLKeyValue> keyValues = mapping.getKeyValues();
        final Set<String> existingKeys = new HashSet<>(keyValues.size());
        for (final YAMLKeyValue keyValue : keyValues) {
            if (keyValue.getKey() != null && !existingKeys.add(keyValue.getKeyText().trim())) {
                annotationHolder.createErrorAnnotation(keyValue.getKey(), "Duplicated property '" + keyValue.getKeyText() + "'").registerFix(new DeletePropertyIntentionAction());
            }
        }
    }
}
 
Example #7
Source File: DustAnnotator.java    From Intellij-Dust with MIT License 6 votes vote down vote up
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
  if (element instanceof DustOpenTag) {
    DustOpenTag openTag = (DustOpenTag) element;
    checkMatchingCloseTag(openTag, holder);
  }

  if (element.getNode().getElementType() == DustTypes.COMMENT) {
    String commentStr = element.getText();

    if (commentStr.length() >= 8) {
      commentStr = commentStr.substring(0, commentStr.length() - 2);
      Pattern p = Pattern.compile("TODO[^\n]*");
      Matcher m = p.matcher(commentStr);

      int startOffset = element.getTextRange().getStartOffset();
      while (m.find()) {
        MatchResult mr = m.toMatchResult();
        TextRange tr = new TextRange(startOffset + mr.start(), startOffset + mr.end());
        holder.createInfoAnnotation(tr, null).setTextAttributes(DustSyntaxHighlighter.TODO);
      }
    }
  }
}
 
Example #8
Source File: ANTLRv4ExternalAnnotator.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** Called 3rd */
@Override
public void apply(@NotNull PsiFile file,
				  List<GrammarIssue> issues,
				  @NotNull AnnotationHolder holder)
{
	for ( GrammarIssue issue : issues ) {
		if ( issue.getOffendingTokens().isEmpty() ) {
			annotateFileIssue(file, holder, issue);
		} else {
			annotateIssue(file, holder, issue);
		}
	}

	final ANTLRv4PluginController controller = ANTLRv4PluginController.getInstance(file.getProject());
	if ( controller!=null && !ApplicationManager.getApplication().isUnitTestMode() ) {
		controller.getPreviewPanel().autoRefreshPreview(file.getVirtualFile());
	}
}
 
Example #9
Source File: CaseAndDefaultAnnotator.java    From bamboo-soy with Apache License 2.0 6 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder annotationHolder) {
  if (psiElement instanceof ChoiceStatementElement) {
    boolean foundDefault = false;
    for (PsiElement child : psiElement.getChildren()) {
      if (!(child instanceof SoyChoiceClause)) {
        continue;
      }

      SoyChoiceClause clause = (SoyChoiceClause) child;

      if (foundDefault) {
        if (!clause.isDefault()) {
          annotationHolder.createErrorAnnotation(
              child, "{case} clauses are not allowed after {default}.");
        } else if (clause.isDefault()) {
          annotationHolder.createErrorAnnotation(
              child, "There can only be one {default} clause.");
        }
      } else if (clause.isDefault()) {
        foundDefault = true;
      }
    }
  }
}
 
Example #10
Source File: RedefinedTokenAnnotation.java    From glsl4idea with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void annotate(GLSLRedefinedToken identifier, AnnotationHolder holder) {
    String definition;

    final IElementType identifierType = identifier.getNode().getElementType();
    if(identifierType instanceof GLSLElementTypes.RedefinedTokenElementType){
        definition = ((GLSLElementTypes.RedefinedTokenElementType) identifierType).text;
    }else{
        GLSLMacroReference reference = identifier.getReference();
        GLSLDefineDirective referent = (reference != null) ? reference.resolve() : null;
        definition = (referent != null) ? referent.getBoundText() : null;
    }

    Annotation annotation = holder.createInfoAnnotation(identifier, definition);
    annotation.setTextAttributes(GLSLHighlighter.GLSL_REDEFINED_TOKEN[0]);
}
 
Example #11
Source File: GivenParametersAnnotator.java    From bamboo-soy with Apache License 2.0 6 votes vote down vote up
private static void checkMissingRequiredParameters(
    @NotNull AnnotationHolder annotationHolder,
    PsiElement identifier,
    Collection<ParameterSpecification> givenParameters,
    List<Parameter> declaredParameters) {

  List<String> requiredParameterNames =
      declaredParameters.stream()
          .filter(var -> !var.isOptional)
          .map(var -> var.name)
          .collect(Collectors.toList());
  List<String> givenParameterNames =
      givenParameters.stream().map(ParameterSpecification::name).collect(Collectors.toList());

  if (!givenParameterNames.containsAll(requiredParameterNames)) {
    requiredParameterNames.removeAll(givenParameterNames);
    annotationHolder.createErrorAnnotation(
        identifier, "Missing required parameters: " + String.join(",", requiredParameterNames));
  }
}
 
Example #12
Source File: MemberCheckAnnotation.java    From glsl4idea with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void annotate(GLSLFieldSelectionExpression expr, AnnotationHolder holder) {
    GLSLExpression leftHandExpression = expr.getLeftHandExpression();
    if(leftHandExpression == null)return;

    GLSLType leftHandType = leftHandExpression.getType();

    if (leftHandType instanceof GLSLStructType) {
        GLSLIdentifier memberIdentifier = expr.getMemberIdentifier();
        if(memberIdentifier == null)return;
        if (!leftHandType.hasMember(memberIdentifier.getName())) {
            holder.createErrorAnnotation(memberIdentifier, "Unknown member for " + leftHandType.getTypename());
        }

    }

}
 
Example #13
Source File: CamelEndpointAnnotator.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
private void validateEndpointReference(PsiElement element, String camelQuery, AnnotationHolder holder) {
    if (!getIdeaUtils().isJavaLanguage(element)) { //no need, unresolvable references in XML are already highlighted
        return;
    }
    if (CamelEndpoint.isDirectEndpoint(camelQuery)) { //only direct endpoints have references (for now)
        Arrays.stream(element.getReferences())
            .filter(r -> r instanceof DirectEndpointReference)
            .map(r -> (DirectEndpointReference) r)
            .findAny()
            .ifPresent(endpointReference -> {
                ResolveResult[] targets = endpointReference.multiResolve(false);
                if (targets.length == 0) {
                    TextRange range = endpointReference.getRangeInElement().shiftRight(element.getTextRange().getStartOffset());
                    holder.createErrorAnnotation(range, "Cannot find endpoint declaration: " + endpointReference.getCanonicalText());
                }
            });
    }
}
 
Example #14
Source File: EelHelperMethodAnnotator.java    From intellij-neos with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof FusionMethodCall) {
        FusionMethodCall methodCall = (FusionMethodCall) element;
        if (methodCall.getPrevSibling() != null && methodCall.getPrevSibling().getPrevSibling() instanceof FusionCompositeIdentifier) {
            FusionCompositeIdentifier compositeId = (FusionCompositeIdentifier) methodCall.getPrevSibling().getPrevSibling();
            List<String> helpers = FileBasedIndex.getInstance().getValues(DefaultContextFileIndex.KEY, compositeId.getText(), GlobalSearchScope.allScope(element.getProject()));
            if (!helpers.isEmpty()) {
                for (String helper : helpers) {
                     if (PhpElementsUtil.getClassMethod(element.getProject(), helper, methodCall.getMethodName().getText()) != null) {
                         return;
                     }
                }

                holder.createErrorAnnotation(methodCall, "Unresolved EEL helper method");
            }
        }
    }
}
 
Example #15
Source File: SQFControlStructureCommandAnnotator.java    From arma-intellij-plugin with MIT License 6 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	if (!(element instanceof SQFCommand)) {
		return;
	}
	SQFCommand command = (SQFCommand) element;
	switch (command.getCommandName().toLowerCase()) {
		case "if": //fall
		case "then": //fall
		case "else": //fall
		case "for": //fall
		case "foreach": //fall
		case "switch": //fall
		case "case": //fall
		case "default": //fall
		case "while"://fall
		case "do": {
			Annotation annotation = holder.createInfoAnnotation(command, "");
			annotation.setTextAttributes(SQFSyntaxHighlighter.CONTROL_STRUCTURE_COMMAND);
			break;
		}
	}
}
 
Example #16
Source File: SQFControlStructureCommandAnnotator.java    From arma-intellij-plugin with MIT License 6 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	if (!(element instanceof SQFCommand)) {
		return;
	}
	SQFCommand command = (SQFCommand) element;
	switch (command.getCommandName().toLowerCase()) {
		case "if": //fall
		case "then": //fall
		case "else": //fall
		case "for": //fall
		case "foreach": //fall
		case "switch": //fall
		case "case": //fall
		case "default": //fall
		case "while"://fall
		case "do": {
			Annotation annotation = holder.createInfoAnnotation(command, "");
			annotation.setTextAttributes(SQFSyntaxHighlighter.CONTROL_STRUCTURE_COMMAND);
			break;
		}
	}
}
 
Example #17
Source File: GraphQLValidationAnnotator.java    From js-graphql-intellij-plugin with MIT License 6 votes vote down vote up
private Optional<Annotation> createErrorAnnotation(@NotNull AnnotationHolder annotationHolder, PsiElement errorPsiElement, String message) {
    if (GraphQLRelayModernAnnotationFilter.getService(errorPsiElement.getProject()).errorIsIgnored(errorPsiElement)) {
        return Optional.empty();
    }
    // error locations from graphql-java will give us the beginning of a type definition including the description
    final GraphQLQuotedString quotedString = PsiTreeUtil.getParentOfType(errorPsiElement, GraphQLQuotedString.class);
    if (quotedString != null) {
        // check if this is the description
        final GraphQLDescriptionAware descriptionAware = PsiTreeUtil.getParentOfType(quotedString, GraphQLDescriptionAware.class);
        if (descriptionAware != null && descriptionAware.getDescription() == quotedString) {
            final GraphQLIdentifier describedName = PsiTreeUtil.findChildOfType(descriptionAware, GraphQLIdentifier.class);
            if (describedName != null) {
                // highlight the identifier (e.g. type name) that has the error instead
                errorPsiElement = describedName;
            }
        }
    }
    return Optional.of(annotationHolder.createErrorAnnotation(errorPsiElement, message));
}
 
Example #18
Source File: BashAnnotator.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
private void annotateBinaryData(BashBinaryDataElement element, AnnotationHolder annotationHolder) {
    Annotation annotation = annotationHolder.createInfoAnnotation(element, null);
    annotation.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);

    annotation = annotationHolder.createInfoAnnotation(element, null);
    annotation.setTextAttributes(BashSyntaxHighlighter.BINARY_DATA);
    annotation.setNeedsUpdateOnTyping(false);
}
 
Example #19
Source File: StepAnnotator.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
    if (!helper.isGaugeModule(element)) return;
    if (element instanceof SpecStep)
        createWarning(element, holder, (SpecStep) element);
    else if (element instanceof ConceptStep) {
        SpecStepImpl step = new SpecStepImpl(element.getNode());
        step.setConcept(true);
        createWarning(element, holder, step);
    }
}
 
Example #20
Source File: SampleExternalAnnotator.java    From jetbrains-plugin-sample with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Called 3rd to actually annotate the editor window */
@Override
public void apply(@NotNull PsiFile file,
				  List<Issue> issues,
				  @NotNull AnnotationHolder holder)
{
	for (Issue issue : issues) {
		TextRange range = issue.offendingNode.getTextRange();
		holder.createErrorAnnotation(range, issue.msg);
	}
}
 
Example #21
Source File: WeexAnnotator.java    From weex-language-support with MIT License 5 votes vote down vote up
private void checkAttributes(XmlTag tag, @NotNull AnnotationHolder annotationHolder) {
    if (tag.getLocalName().toLowerCase().equals("template")) {
        for (XmlTag child : tag.getSubTags()) {
            checkAttributeValue(child, annotationHolder);
        }
    }
}
 
Example #22
Source File: FlutterEditorAnnotator.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static void attachIcon(final PsiElement element, AnnotationHolder holder, Icon icon) {
  try {
    final Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setGutterIconRenderer(new FlutterIconRenderer(icon, element));
  }
  catch (Exception ignored) {
  }
}
 
Example #23
Source File: WeexAnnotator.java    From weex-language-support with MIT License 5 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder annotationHolder) {
    if (!psiElement.getContainingFile().getVirtualFile().getName().toLowerCase().endsWith(".we")) {
        return;
    }
    if (psiElement instanceof XmlDocument) {
        checkStructure(psiElement, annotationHolder);
    }

    if (psiElement instanceof XmlTag && ((XmlTag) psiElement).getName().equals("script")) {
        label:
        for (PsiElement element : psiElement.getChildren()) {
            if (element instanceof JSEmbeddedContent) {
                script = (JSEmbeddedContent) element;
                for (PsiElement element1 : script.getChildren()) {
                    if (element1 instanceof JSExpressionStatement) {
                        for (PsiElement element2 : element1.getChildren()) {
                            if (element2 instanceof JSAssignmentExpression) {
                                PsiElement[] children = element2.getChildren();
                                if (children.length == 2) {
                                    if (children[0].getText().equals("module.exports")) {
                                        moduleExports = (JSObjectLiteralExpression) children[1];
                                        break label;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 
Example #24
Source File: WeaveAnnotator.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof WeaveKeyExpression) {
        holder.createInfoAnnotation(element, "Property key").setTextAttributes(WeaveSyntaxHighlighter.KEY);
    }
    if (element instanceof WeaveIdentifier && element.getParent() instanceof WeaveFunctionDefinition) {
        holder.createInfoAnnotation(element, "Function").setTextAttributes(WeaveSyntaxHighlighter.FUNCTION_DECLARATION);
    }
    if (element instanceof WeaveIdentifier && element.getParent() instanceof WeaveVariableDefinition) {
        holder.createInfoAnnotation(element, "Variable").setTextAttributes(WeaveSyntaxHighlighter.VARIABLE);
    }
    if (element instanceof WeaveIdentifier && element.getParent() instanceof WeaveFunctionCallExpression) {
        holder.createInfoAnnotation(element, "Function call").setTextAttributes(WeaveSyntaxHighlighter.FUNCTION_CALL);
    }
}
 
Example #25
Source File: LValueAnnotator.java    From glsl4idea with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void annotate(GLSLAssignmentExpression expr, AnnotationHolder holder) {
    GLSLExpression left = expr.getLeftOperand();
    if(left == null)return;

    if (!left.isLValue()) {
        holder.createErrorAnnotation(left, "Left operand of assignment expression is not L-Value.");
    }
}
 
Example #26
Source File: BuckAnnotator.java    From buck with Apache License 2.0 5 votes vote down vote up
/** Colorize named parameters in function definitions. */
private void annotateBuckParameter(BuckParameter parameter, AnnotationHolder annotationHolder) {
  Optional.ofNullable(parameter.getIdentifier())
      .ifPresent(
          identifier -> {
            Annotation annotation = annotationHolder.createInfoAnnotation(identifier, null);
            annotation.setTextAttributes(BuckSyntaxHighlighter.BUCK_PROPERTY_LVALUE);
          });
}
 
Example #27
Source File: MMAnnotator.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
public void annotate(@Nonnull PsiElement element, @Nonnull AnnotationHolder holder) {
  if (!(element instanceof MMPsiElement)) {
    return;
  }
  final ASTNode keyNode = element.getNode();
  highlightTokens(keyNode, holder, new MMHighlighter());
}
 
Example #28
Source File: ParamAnnotator.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
    if (helper.isGaugeModule(psiElement) && psiElement instanceof PsiMethod)
        helper.getStepValues((PsiMethod) psiElement).stream()
                .filter(value -> value.getParameters().size() != ((PsiMethod) psiElement).getParameterList().getParametersCount())
                .forEach(value -> createWarning((PsiMethod) psiElement, holder, value.getStepAnnotationText(), value));
}
 
Example #29
Source File: StatementParentAnnotation.java    From glsl4idea with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void annotate(GLSLStatement expr, AnnotationHolder holder) {
    AcceptableParents acceptableParents = parentsForClass.get(expr.getClass());
    if (acceptableParents == null) return;
    PsiElement parent = expr.findParentByClasses(acceptableParents.parents);
    if (parent == null) { // we needed a parent and we couldn't find one - this is a compile-time error
        holder.createErrorAnnotation(expr, acceptableParents.message);
    }
}
 
Example #30
Source File: BashAnnotator.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
private void highlightKeywordTokens(@NotNull PsiElement element, @NotNull AnnotationHolder annotationHolder) {
    ASTNode node = element.getNode();
    if (node == null) {
        return;
    }

    IElementType elementType = node.getElementType();
    boolean isKeyword = elementType == BashTokenTypes.IN_KEYWORD_REMAPPED
            || elementType == BashTokenTypes.WORD && "!".equals(element.getText());

    if (isKeyword) {
        Annotation annotation = annotationHolder.createInfoAnnotation(element, null);
        annotation.setTextAttributes(BashSyntaxHighlighter.KEYWORD);
    }
}