private void annotateNumber(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.NUMBER); } }
private void annotateText(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.STRING); }
private void annotateInlineCode(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.DOCUMENTATION_INLINE_CODE); }
private void annotateStringLiteralTemplateEnd(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.TEMPLATE_LANGUAGE_COLOR); }
private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) { holder.createInfoAnnotation(element, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER); String description = ApplicationManager.getApplication().isUnitTestMode() ? key.getExternalName() : null; holder.createInfoAnnotation(element, description).setTextAttributes(key); }
private void annotateKeyword(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey textAttributesKey, boolean excludeEndChar) { TextRange textRange = element.getTextRange(); TextRange newTextRange = new TextRange(textRange.getStartOffset(), textRange.getEndOffset() - (excludeEndChar ? 1 : 0)); Annotation annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(textAttributesKey); }
private void annotateTemplateStart(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { TextRange textRange = element.getTextRange(); TextRange newTextRange = new TextRange(textRange.getEndOffset() - 1, textRange.getEndOffset()); Annotation annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.STRING); }
private void annotateKeyword(@NotNull PsiElement element, @NotNull AnnotationHolder holder, boolean excludeEndChar) { TextRange textRange = element.getTextRange(); TextRange newTextRange = new TextRange(textRange.getStartOffset(), textRange.getEndOffset() - (excludeEndChar ? 1 : 0)); Annotation annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.KEYWORD); }
private void annotateExpressionTemplateStart(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { TextRange textRange = element.getTextRange(); TextRange newTextRange = new TextRange(textRange.getEndOffset() - 2, textRange.getEndOffset()); Annotation annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.TEMPLATE_LANGUAGE_COLOR); if (textRange.getEndOffset() - 2 > textRange.getStartOffset()) { newTextRange = new TextRange(textRange.getStartOffset(), textRange.getEndOffset() - 2); annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.STRING); } }
@Override public void annotate(@NotNull PsiElement psiElement, @NotNull com.intellij.lang.annotation.AnnotationHolder annotationHolder) { if (psiElement instanceof ErlangAtom) { ErlangAtom erlangAtom = (ErlangAtom) psiElement; String name = erlangAtom.getName(); if (name.startsWith(ELIXIR_ALIAS_PREFIX)) { Project project = psiElement.getProject(); Collection<NamedElement> namedElementCollection = StubIndex.getElements( ModularName.KEY, name, project, GlobalSearchScope.allScope(project), NamedElement.class ); if (namedElementCollection.size() > 0) { TextRange textRange = psiElement.getTextRange(); String unprefixedName = name.substring(ELIXIR_ALIAS_PREFIX.length(), name.length()); Annotation annotation = annotationHolder.createInfoAnnotation(textRange, "Resolves to Elixir Module " + unprefixedName); annotation.setTextAttributes(DefaultLanguageHighlighterColors.LINE_COMMENT); } else { TextRange textRange = psiElement.getTextRange(); annotationHolder.createErrorAnnotation(textRange, "Unresolved Elixir Module"); } } } } }
if (parent instanceof BallerinaAnnotationAttachment) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.ANNOTATION); return; .getParent() instanceof BallerinaGlobalVariableDefinition)) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.GLOBAL_VARIABLE); if (parent instanceof BallerinaAnnotationAttachment) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.ANNOTATION); || elementType == BallerinaTypes.DEPRECATED_TEMPLATE_TEXT) { Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.DOCUMENTATION); } else if (elementType == BallerinaTypes.MARKDOWN_DOCUMENTATION_LINE_START) { TextRange textRange = element.getTextRange(); TextRange newTextRange = new TextRange(startOffset, startOffset + 1); Annotation annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.DOCUMENTATION); } else if (elementType == BallerinaTypes.PARAMETER_DOCUMENTATION_START) { TextRange textRange = element.getTextRange(); TextRange newTextRange = new TextRange(startOffset, startOffset + 1); Annotation annotation = holder.createInfoAnnotation(newTextRange, null); annotation.setTextAttributes(BallerinaSyntaxHighlightingColors.DOCUMENTATION);
private void annotateSubshell(PsiElement element, AnnotationHolder holder) { final Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(BashSyntaxHighlighter.SUBSHELL_COMMAND); } }
public void decorateElement(PsiElement element, @NotNull AnnotationHolder holder, TextAttributesKey key) { if (element == null) { return; } holder.createInfoAnnotation(element, null).setTextAttributes(key); } }
@Override public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { if (element instanceof HTMLMasonNamedElement) { PsiElement nameIdentifier = ((HTMLMasonNamedElement)element).getNameIdentifier(); if (nameIdentifier != null) { holder.createInfoAnnotation(nameIdentifier, null).setTextAttributes(PerlSyntaxHighlighter.PERL_SUB_DEFINITION); } } } }
protected void highlightVariable(@NotNull BashVar element, @NotNull AnnotationHolder annotationHolder) { if (element.isBuiltinVar()) { //highlighting for built-in variables Annotation annotation = annotationHolder.createInfoAnnotation(element, null); annotation.setTextAttributes(BashSyntaxHighlighter.VAR_USE_BUILTIN); } else if (element.isParameterExpansion()) { //highlighting for composed variables Annotation annotation = annotationHolder.createInfoAnnotation(element, null); annotation.setTextAttributes(BashSyntaxHighlighter.VAR_USE_COMPOSED); } }
@Override public void visitElement(PsiElement element) { if (element instanceof BashVar) { //containedVars.add((BashVar) containerElement); Annotation infoAnnotation = holder.createInfoAnnotation(element, null); infoAnnotation.setTextAttributes(BashSyntaxHighlighter.VAR_USE); } super.visitElement(element); } }.visitElement(containerElement);
private void annotateVarDef(BashVarDef bashVarDef, AnnotationHolder annotationHolder) { final PsiElement identifier = bashVarDef.findAssignmentWord(); if (identifier != null) { final Annotation annotation = annotationHolder.createInfoAnnotation(identifier, null); annotation.setTextAttributes(BashSyntaxHighlighter.VAR_DEF); } }
private static void addRuleHighlighting(BnfRule rule, PsiElement psiElement, AnnotationHolder annotationHolder) { if (ParserGeneratorUtil.Rule.isMeta(rule)) { annotationHolder.createInfoAnnotation(psiElement, null).setTextAttributes(BnfSyntaxHighlighter.META_RULE); } else { annotationHolder.createInfoAnnotation(psiElement, null).setTextAttributes(BnfSyntaxHighlighter.RULE); } PsiFile file = rule.getContainingFile(); if (StringUtil.isNotEmpty(((BnfFile)file).findAttributeValue(rule, KnownAttribute.RECOVER_WHILE, null))) { annotationHolder.createInfoAnnotation(psiElement, null).setTextAttributes(BnfSyntaxHighlighter.RECOVER_MARKER); } }
private void hightlightRemappedTokens(PsiElement element, AnnotationHolder annotationHolder) { if (element.getNode().getElementType() == BashTokenTypes.IN_KEYWORD_REMAPPED) { Annotation annotation = annotationHolder.createInfoAnnotation(element, null); annotation.setTextAttributes(BashSyntaxHighlighter.KEYWORD); } }
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); }