Package org.intellij.lang.annotations
Annotation Interface Language
@Documented
@Retention(CLASS)
@Target({METHOD,FIELD,PARAMETER,LOCAL_VARIABLE,ANNOTATION_TYPE})
public @interface Language
Specifies that an element of the program represents a string that is a source code on a specified language.
Code editors may use this annotation to enable syntax highlighting, code completion and other features
inside the literals that assigned to the annotated variables, passed as arguments to the annotated parameters,
or returned from the annotated methods.
This annotation also could be used as a meta-annotation, to define derived annotations for convenience. E.g. the following annotation could be defined to annotate the strings that represent Java methods:
@Language(value = "JAVA", prefix = "class X{", suffix = "}") @interface JavaMethod {}
Note that using the derived annotation as meta-annotation is not supported. Meta-annotation works only one level deep.
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
value
Language name like "JAVA", "HTML", "XML", "RegExp", etc. The complete list of supported languages is not specified. However, at least the following languages should be recognized:- "JAVA" - Java programming language
- "HTML" - HTML
- "XML" - XML
- "RegExp" - Regular expression supported by Java
Pattern
-
prefix
A constant prefix that is assumed to be implicitly added before the literal. This helps to apply proper highlighting when the program element represents only a part of the valid program. E.g. if the method parameter accepts a Java method, it could be annotated asvoid methodProcessor(@Language(value="JAVA", prefix="class X {", suffix="}")
.- Default:
""
-
suffix
A constant suffix that is assumed to be implicitly added after the literal. Seeprefix()
for details.- Default:
""
-